Esempio n. 1
0
 public static IValue fromObject(Object o) {
   if (o == null) {
     return new NullValue();
   }
   Class c = o.getClass();
   if (c == Character.class) {
     return new CharValue((Character) o);
   } else if (c == Integer.class) {
     return new IntValue((Integer) o);
   } else if (c == Long.class) {
     return new LongValue((Long) o);
   } else if (c == Float.class) {
     return new FloatValue((Float) o);
   } else if (c == Double.class) {
     return new DoubleValue((Double) o);
   } else if (c == String.class) {
     return new StringValue((String) o);
   } else if (c == int[].class) {
     Array valueList = new Array(null);
     valueList.requiredType = new ArrayType(Types.INT);
     valueList.elementType = Types.INT;
     for (int i : (int[]) o) {
       valueList.addValue(new IntValue(i));
     }
     return valueList;
   } else if (c == long[].class) {
     Array valueList = new Array();
     valueList.requiredType = new ArrayType(Types.LONG);
     valueList.elementType = Types.LONG;
     for (long l : (long[]) o) {
       valueList.addValue(new LongValue(l));
     }
     return valueList;
   } else if (c == float[].class) {
     Array valueList = new Array();
     valueList.requiredType = new ArrayType(Types.FLOAT);
     valueList.elementType = Types.FLOAT;
     for (float f : (float[]) o) {
       valueList.addValue(new FloatValue(f));
     }
     return valueList;
   } else if (c == double[].class) {
     Array valueList = new Array();
     valueList.requiredType = new ArrayType(Types.DOUBLE);
     valueList.elementType = Types.DOUBLE;
     for (double d : (double[]) o) {
       valueList.addValue(new DoubleValue(d));
     }
     return valueList;
   } else if (c == org.objectweb.asm.Type.class) {
     org.objectweb.asm.Type type = (org.objectweb.asm.Type) o;
     return new ClassOperator(Types.fromASMType(type));
   }
   return null;
 }
Esempio n. 2
0
 @Override
 public void setReferenceType() {
   if (this.refType == null) {
     this.refType = Types.getSimpleRef(this.type);
   }
 }