@Override protected String toString(Object array, int index) { return ForNonArrayType.BOOLEAN.toString(Array.getBoolean(array, index)); } },
protected String arrayToString(Object o) { int len = Array.getLength(o); Class c = o.getClass().getComponentType(); String res = "[ "; for (int i = 0; i < len; i++) { if ( c == byte.class ) res+=Array.getByte(o,i); if ( c == boolean.class ) res+=Array.getBoolean(o, i); if ( c == char.class ) res+=Array.getChar(o, i); if ( c == short.class ) res+=Array.getShort(o, i); if ( c == int.class ) res+=Array.getInt(o, i); if ( c == long.class ) res+=Array.getLong(o, i); if ( c == float.class ) res+=Array.getFloat(o, i); if ( c == double.class ) res+=Array.getDouble(o, i); if ( i < len-1) res+=","; } res += " ]"; return res; }
protected String arrayToString(Object o) { int len = Array.getLength(o); Class c = o.getClass().getComponentType(); String res = "[ "; for (int i = 0; i < len; i++) { if ( c == byte.class ) res+=Array.getByte(o,i); if ( c == boolean.class ) res+=Array.getBoolean(o, i); if ( c == char.class ) res+=Array.getChar(o, i); if ( c == short.class ) res+=Array.getShort(o, i); if ( c == int.class ) res+=Array.getInt(o, i); if ( c == long.class ) res+=Array.getLong(o, i); if ( c == float.class ) res+=Array.getFloat(o, i); if ( c == double.class ) res+=Array.getDouble(o, i); if ( i < len-1) res+=","; } res += " ]"; return res; }
for (int i = start; i < start + len; i++) { if (componentType == boolean.class) writeRawInt(type, Array.getBoolean(primitiveArray, i) ? 1 : 0); else writeRawInt(type, Array.getLong(primitiveArray, i));
for (int i = start; i < start + len; i++) { if (componentType == boolean.class) writeRawInt(type, Array.getBoolean(primitiveArray, i) ? 1 : 0); else writeRawInt(type, Array.getLong(primitiveArray, i));
dest[i] = Array.getBoolean(array, i);
@Override public E get(E[] array, int index) { if (componentType == boolean.class) { Boolean b = Array.getBoolean(array, index); return (E)b; } else { return array[index]; } } @Override
@Override public Object get(Object array, int index) { return Array.getBoolean(array, index); }
@Override protected String toString(Object array, int index) { return ForNonArrayType.BOOLEAN.toString(Array.getBoolean(array, index)); } },
/** * @throws IOException * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, * WicketObjectOutputStream) */ public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException { int length = Array.getLength(object); dos.writeInt(length); for (int i = 0; i < length; i++) { dos.writeBoolean(Array.getBoolean(object, i)); } }
/** * @throws IOException * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, * WicketObjectOutputStream) */ @Override public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException { int length = Array.getLength(object); dos.writeInt(length); for (int i = 0; i < length; i++) { dos.writeBoolean(Array.getBoolean(object, i)); } }
public static Object toObject(Object value) { if (!value.getClass().isArray()) return value; Class type = value.getClass().getComponentType(); if (Array.getLength(value) == 0) return null; if (!type.isPrimitive()) return Array.get(value, 0); if (boolean.class.isAssignableFrom(type)) return Array.getBoolean(value, 0); if (char.class.isAssignableFrom(type)) return new Character(Array.getChar(value, 0)); if (byte.class.isAssignableFrom(type)) return new Byte(Array.getByte(value, 0)); if (int.class.isAssignableFrom(type)) return new Integer(Array.getInt(value, 0)); if (long.class.isAssignableFrom(type)) return new Long(Array.getLong(value, 0)); if (short.class.isAssignableFrom(type)) return new Short(Array.getShort(value, 0)); if (double.class.isAssignableFrom(type)) return new Double(Array.getDouble(value, 0)); if (float.class.isAssignableFrom(type)) return new Float(Array.getFloat(value, 0)); return null; }
dest[i] = Array.getBoolean(array, i);
/** * Gets an item from an array. */ public Object arrayItem(Object dataSet, int ordinal) { // Plain old Array.get doesn't cut it when you have an array of // Integer values but you want to read Short values. Array.getShort // does the right thing. switch (this) { case DOUBLE: return Array.getDouble(dataSet, ordinal); case FLOAT: return Array.getFloat(dataSet, ordinal); case BOOLEAN: return Array.getBoolean(dataSet, ordinal); case BYTE: return Array.getByte(dataSet, ordinal); case CHAR: return Array.getChar(dataSet, ordinal); case SHORT: return Array.getShort(dataSet, ordinal); case INT: return Array.getInt(dataSet, ordinal); case LONG: return Array.getLong(dataSet, ordinal); case OTHER: return Array.get(dataSet, ordinal); default: throw new AssertionError("unexpected " + this); } }
/** * Gets an item from an array. */ public Object arrayItem(Object dataSet, int ordinal) { // Plain old Array.get doesn't cut it when you have an array of // Integer values but you want to read Short values. Array.getShort // does the right thing. switch (this) { case DOUBLE: return Array.getDouble(dataSet, ordinal); case FLOAT: return Array.getFloat(dataSet, ordinal); case BOOLEAN: return Array.getBoolean(dataSet, ordinal); case BYTE: return Array.getByte(dataSet, ordinal); case CHAR: return Array.getChar(dataSet, ordinal); case SHORT: return Array.getShort(dataSet, ordinal); case INT: return Array.getInt(dataSet, ordinal); case LONG: return Array.getLong(dataSet, ordinal); case OTHER: return Array.get(dataSet, ordinal); default: throw new AssertionError("unexpected " + this); } }
@JTranscSync public static Object get(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException { Type elementType = getArrayElementType(array.getClass()); if (elementType == Boolean.TYPE) return getBoolean(array, index); if (elementType == Byte.TYPE) return getByte(array, index); if (elementType == Character.TYPE) return getChar(array, index); if (elementType == Short.TYPE) return getShort(array, index); if (elementType == Integer.TYPE) return getInt(array, index); if (elementType == Long.TYPE) return getLong(array, index); if (elementType == Float.TYPE) return getFloat(array, index); if (elementType == Double.TYPE) return getDouble(array, index); return getInstance(array, index); }
@Override public E get(Object array, int index) { if (componentType == boolean.class) { Boolean b = Array.getBoolean(array, index); return (E)b; } else if (componentType == int.class) {
private void putArrayElementValues(char elementType, @Nonnull Object array) { int length = Array.getLength(array); putArrayLength(length); for (int i = 0; i < length; i++) { if (elementType == 'J') { long value = Array.getLong(array, i); putLong(value); } else if (elementType == 'F') { float value = Array.getFloat(array, i); putFloat(value); } else if (elementType == 'D') { double value = Array.getDouble(array, i); putDouble(value); } else if (elementType == 'Z') { boolean value = Array.getBoolean(array, i); putBoolean(value); } else { int value = Array.getInt(array, i); putInteger(elementType, value); } } }
return; case BOOLEAN: sink.set(Array.getBoolean(dataSet, ordinal)); return; case BYTE:
value = new CharSparseValue(charValue); } else if (realValues instanceof boolean[]) { boolean booleanValue = Array.getBoolean(realValues, index); value = new BooleanSparseValue(booleanValue); } else {