Search in sources :

Example 96 with Array

use of lucee.runtime.type.Array in project Lucee by lucee.

the class ArrayUtil method toNullArray.

public static Object[] toNullArray(Object obj) throws PageException {
    Array arr = Caster.toArray(obj);
    Object[] tarr = new Object[arr.size()];
    for (int i = 0; i < tarr.length; i++) {
        tarr[i] = Caster.toNull(arr.getE(i + 1));
    }
    return tarr;
}
Also used : Array(lucee.runtime.type.Array)

Example 97 with Array

use of lucee.runtime.type.Array in project Lucee by lucee.

the class ArrayUtil method toBooleanArray.

public static boolean[] toBooleanArray(Object obj) throws PageException {
    if (obj instanceof boolean[])
        return (boolean[]) obj;
    Array arr = Caster.toArray(obj);
    boolean[] tarr = new boolean[arr.size()];
    for (int i = 0; i < tarr.length; i++) {
        tarr[i] = Caster.toBooleanValue(arr.getE(i + 1));
    }
    return tarr;
}
Also used : Array(lucee.runtime.type.Array)

Example 98 with Array

use of lucee.runtime.type.Array in project Lucee by lucee.

the class ArrayUtil method toShortArray.

public static short[] toShortArray(Object obj) throws PageException {
    if (obj instanceof short[])
        return (short[]) obj;
    Array arr = Caster.toArray(obj);
    short[] tarr = new short[arr.size()];
    for (int i = 0; i < tarr.length; i++) {
        tarr[i] = Caster.toShortValue(arr.getE(i + 1));
    }
    return tarr;
}
Also used : Array(lucee.runtime.type.Array)

Example 99 with Array

use of lucee.runtime.type.Array in project Lucee by lucee.

the class ArrayUtil method toByteArray.

public static byte[] toByteArray(Object obj) throws PageException {
    if (obj instanceof byte[])
        return (byte[]) obj;
    Array arr = Caster.toArray(obj);
    byte[] tarr = new byte[arr.size()];
    for (int i = 0; i < tarr.length; i++) {
        tarr[i] = Caster.toByteValue(arr.getE(i + 1));
    }
    return tarr;
}
Also used : Array(lucee.runtime.type.Array)

Example 100 with Array

use of lucee.runtime.type.Array in project Lucee by lucee.

the class ArrayUtil method toLongArray.

public static long[] toLongArray(Object obj) throws PageException {
    if (obj instanceof long[])
        return (long[]) obj;
    Array arr = Caster.toArray(obj);
    long[] tarr = new long[arr.size()];
    for (int i = 0; i < tarr.length; i++) {
        tarr[i] = Caster.toLongValue(arr.getE(i + 1));
    }
    return tarr;
}
Also used : Array(lucee.runtime.type.Array)

Aggregations

Array (lucee.runtime.type.Array)169 ArrayImpl (lucee.runtime.type.ArrayImpl)79 Struct (lucee.runtime.type.Struct)49 StructImpl (lucee.runtime.type.StructImpl)25 Iterator (java.util.Iterator)24 PageException (lucee.runtime.exp.PageException)23 Entry (java.util.Map.Entry)22 ArrayList (java.util.ArrayList)20 Key (lucee.runtime.type.Collection.Key)20 ListIterator (java.util.ListIterator)16 Query (lucee.runtime.type.Query)16 List (java.util.List)14 ApplicationException (lucee.runtime.exp.ApplicationException)14 FunctionException (lucee.runtime.exp.FunctionException)14 ForEachQueryIterator (lucee.runtime.type.it.ForEachQueryIterator)14 Resource (lucee.commons.io.res.Resource)13 IOException (java.io.IOException)12 Collection (lucee.runtime.type.Collection)10 QueryImpl (lucee.runtime.type.QueryImpl)10 JavaObject (lucee.runtime.java.JavaObject)8