public Object invoke(Object object, Object[] args) { final char[] objects = (char[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); objects[index] = DefaultTypeTransformation.getCharFromSizeOneString(args[1]); return null; }
private static Object adjustNewValue(Object[] objects, Object newValue) { Class arrayComponentClass = objects.getClass().getComponentType(); Object adjustedNewVal = newValue; if (newValue instanceof Number) { if (!arrayComponentClass.equals(newValue.getClass())) { adjustedNewVal = DefaultTypeTransformation.castToType(newValue, arrayComponentClass); } } else if (Character.class.isAssignableFrom(arrayComponentClass)) { adjustedNewVal = DefaultTypeTransformation.getCharFromSizeOneString(newValue); } else if (Number.class.isAssignableFrom(arrayComponentClass)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); adjustedNewVal = DefaultTypeTransformation.castToType(ch, arrayComponentClass); } } else if (arrayComponentClass.isArray()) { adjustedNewVal = DefaultTypeTransformation.castToType(newValue, arrayComponentClass); } return adjustedNewVal; }
public Object invoke(Object object, Object[] args) { final short[] objects = (short[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Short)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Short) DefaultTypeTransformation.castToType(ch, Short.class); } else { objects[index] = ((Number) newValue).shortValue(); } } else objects[index] = (Short) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final double[] objects = (double[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Double)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Double) DefaultTypeTransformation.castToType(ch, Double.class); } else { objects[index] = ((Number) newValue).doubleValue(); } } else objects[index] = (Double) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final int[] objects = (int[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Integer)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Integer) DefaultTypeTransformation.castToType(ch, Integer.class); } else { objects[index] = ((Number) newValue).intValue(); } } else objects[index] = (Integer) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final long[] objects = (long[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Long)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Long) DefaultTypeTransformation.castToType(ch, Long.class); } else { objects[index] = ((Number) newValue).longValue(); } } else objects[index] = (Long) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final float[] objects = (float[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Float)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Float) DefaultTypeTransformation.castToType(ch, Float.class); } else { objects[index] = ((Number) newValue).floatValue(); } } else objects[index] = (Float) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final char[] objects = (char[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); objects[index] = DefaultTypeTransformation.getCharFromSizeOneString(args[1]); return null; }
public Object invoke(Object object, Object[] args) { final char[] objects = (char[]) object; final int index = normaliseIndex(((Integer) args[0]).intValue(), objects.length); objects[index] = DefaultTypeTransformation.getCharFromSizeOneString(args[1]).charValue(); return null; }
public Object invoke(Object object, Object[] args) { final char[] objects = (char[]) object; final int index = normaliseIndex(((Integer) args[0]).intValue(), objects.length); objects[index] = DefaultTypeTransformation.getCharFromSizeOneString(args[1]).charValue(); return null; }
public static Character putAt(char[] array, int idx, Object newValue) { newValue = DefaultTypeTransformation.getCharFromSizeOneString(newValue); return (Character) primitiveArrayPut(array, idx, newValue); }
public Object invoke(Object object, Object[] args) { final long[] objects = (long[]) object; final int index = normaliseIndex(((Integer) args[0]).intValue(), objects.length); Object newValue = args[1]; if (!(newValue instanceof Long)) { if(newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = ((Long)DefaultTypeTransformation.castToType(ch, Long.class)).longValue(); } else { Number n = (Number) newValue; objects[index] = ((Number)newValue).longValue(); } } else objects[index] = ((Long)args[1]).longValue(); return null; }
public static Double putAt(double[] array, int idx, Object newValue) { if (!(newValue instanceof Double)) { if(newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); newValue = DefaultTypeTransformation.castToType(ch, Double.class); } else { Number n = (Number) newValue; newValue = new Double(n.doubleValue()); } } return (Double) primitiveArrayPut(array, idx, newValue); }
public static Long putAt(long[] array, int idx, Object newValue) { if (!(newValue instanceof Long)) { if(newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); newValue = DefaultTypeTransformation.castToType(ch, Long.class); } else { Number n = (Number) newValue; newValue = new Long(n.longValue()); } } return (Long) primitiveArrayPut(array, idx, newValue); }
public static Short putAt(short[] array, int idx, Object newValue) { if (!(newValue instanceof Short)) { if(newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); newValue = DefaultTypeTransformation.castToType(ch, Short.class); } else { Number n = (Number) newValue; newValue = new Short(n.shortValue()); } } return (Short) primitiveArrayPut(array, idx, newValue); }
public static Integer putAt(int[] array, int idx, Object newValue) { if (!(newValue instanceof Integer)) { if(newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); newValue = DefaultTypeTransformation.castToType(ch, Integer.class); } else { Number n = (Number) newValue; newValue = new Integer(n.intValue()); } } return (Integer) primitiveArrayPut(array, idx, newValue); }
public static Float putAt(float[] array, int idx, Object newValue) { if (!(newValue instanceof Float)) { if(newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); newValue = DefaultTypeTransformation.castToType(ch, Float.class); } else { Number n = (Number) newValue; newValue = new Float(n.floatValue()); } } return (Float) primitiveArrayPut(array, idx, newValue); }
public Object invoke(Object object, Object[] args) { final long[] objects = (long[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Long)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Long) DefaultTypeTransformation.castToType(ch, Long.class); } else { objects[index] = ((Number) newValue).longValue(); } } else objects[index] = (Long) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final float[] objects = (float[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Float)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Float) DefaultTypeTransformation.castToType(ch, Float.class); } else { objects[index] = ((Number) newValue).floatValue(); } } else objects[index] = (Float) args[1]; return null; }
public Object invoke(Object object, Object[] args) { final double[] objects = (double[]) object; final int index = normaliseIndex((Integer) args[0], objects.length); Object newValue = args[1]; if (!(newValue instanceof Double)) { if (newValue instanceof Character || newValue instanceof String || newValue instanceof GString) { Character ch = DefaultTypeTransformation.getCharFromSizeOneString(newValue); objects[index] = (Double) DefaultTypeTransformation.castToType(ch, Double.class); } else { objects[index] = ((Number) newValue).doubleValue(); } } else objects[index] = (Double) args[1]; return null; }