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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations