@Override protected void setArray(Object array, int pos, Object value) { Array.setShort(array,pos,(Short)value); }
@Override protected void setArray(Object array, int pos, Object value) { Array.setShort(array,pos,(Short)value); }
Array.setChar(newObj, i, (char) ((Number)n).intValue()); else if (arrT == short.class ) Array.setShort(newObj, i, ((Number)n).shortValue()); else if (arrT == int.class ) Array.setInt(newObj, i, ((Number)n).intValue());
Array.setShort(array, index, ((Number) value).shortValue());
Array.setChar(newObj, i, (char) ((Number)n).intValue()); else if (arrT == short.class ) Array.setShort(newObj, i, ((Number)n).shortValue()); else if (arrT == int.class ) Array.setInt(newObj, i, ((Number)n).intValue());
setChar(array, index, ((Character) value).charValue()); } else if (value instanceof Short) { setShort(array, index, ((Short) value).shortValue()); } else if (value instanceof Integer) { setInt(array, index, ((Integer) value).intValue());
for (Iterator iter = list.iterator(); iter.hasNext(); idx++) { Object element = iter.next(); Array.setShort(array, idx, (Short) InvokerHelper.invokeStaticMethod(DefaultGroovyMethods.class, "asType", new Object[]{element, short.class}));
Array.setShort(array, index, ((Number) value).shortValue());
Array.setByte(objArray, i, (Byte) obj); } else if (obj instanceof Short) { Array.setShort(objArray, i, (Short) obj);
@Override protected void setSingleValue(Object array, int index, Object value) { Array.setShort(array, index, (Short) value); } },
@Override protected void setSingleValue(Object array, int index, Object value) { Array.setShort(array, index, (Short) value); } },
@Override protected void setSingleValue(Object array, int index, Object value) { Array.setShort(array, index, (Short) value); } },
@Override public void set(Object array, int index, Object value) { Array.setShort(array, index, (Short) value); } },
@Override protected void setArray(Object array, int pos, Object value) { Array.setShort(array,pos,(Short)value); }
@Override protected void setArray(Object array, int pos, Object value) { Array.setShort(array,pos,(Short)value); }
/** * Byte order reverses an <code>Array</code> of <code>shorts</code> * * @param array input array */ private static void swapShortArray(Object array) { int len = Array.getLength(array); short tmp; int b1, b2; for (int i = 0; i < len; i++) { tmp = Array.getShort(array, i); b1 = (tmp >> 0) & 0xff; b2 = (tmp >> 8) & 0xff; tmp = (short) (b1 << 8 | b2 << 0); Array.setShort(array, i, tmp); } } }
/** * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream) */ public Object readArray(WicketObjectInputStream dos) throws IOException { int length = dos.readInt(); Object array = Array.newInstance(getStreamClass(), length); for (int i = 0; i < length; i++) { Array.setShort(array, i, dos.readShort()); } return array; } }
/** * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream) */ @Override public Object readArray(WicketObjectInputStream dos) throws IOException { int length = dos.readInt(); Object array = Array.newInstance(getStreamClass(), length); for (int i = 0; i < length; i++) { Array.setShort(array, i, dos.readShort()); } return array; } }
@Test public void getSetShortFieldTest() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { if(verifyNoPropertyViolation()) { ShortField sf = new ShortField(); Field f = sf.getClass().getField("f"); f.set(sf, (short)3); assertEquals((short)f.get(sf), (short)3); short[] x = new short[] {1,2,3}; Array.setShort(x, 0, (short) 3); assertEquals(Array.getShort(x, 0), (short)3); } } }
public static void setArrayValue(Object array, Class<?> valueType, Object value, int index) { if (value == null) { return; } if (valueType == int.class) { Array.setInt(array, index, LdiIntegerConversionUtil.toPrimitiveInt(value)); } else if (valueType == double.class) { Array.setDouble(array, index, LdiDoubleConversionUtil.toPrimitiveDouble(value)); } else if (valueType == long.class) { Array.setLong(array, index, LdiLongConversionUtil.toPrimitiveLong(value)); } else if (valueType == float.class) { Array.setFloat(array, index, LdiFloatConversionUtil.toPrimitiveFloat(value)); } else if (valueType == short.class) { Array.setShort(array, index, LdiShortConversionUtil.toPrimitiveShort(value)); } else if (valueType == boolean.class) { Array.setBoolean(array, index, LdiBooleanConversionUtil.toPrimitiveBoolean(value)); } else if (valueType == char.class) { Array.setChar(array, index, ((Character) value).charValue()); } Array.set(array, index, value); }