/** * Set this constant to null. * * @return this instruction, for method chaining */ public ConstantInstruction setNull() { calculateOpcode(null, false, false); return this; }
public ConstantInstruction setValue(String value, boolean clsName) { calculateOpcode(value, clsName, false); return this; }
/** * Set this constant to null. * * @return this instruction, for method chaining */ public ConstantInstruction setNull() { calculateOpcode(null, false, false); return this; }
public ConstantInstruction setValue(String value, boolean clsName) { calculateOpcode(value, clsName, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(double value) { calculateOpcode(new Double(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(float value) { calculateOpcode(new Float(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(float value) { calculateOpcode(new Float(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(double value) { calculateOpcode(new Double(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(long value) { calculateOpcode(Numbers.valueOf(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(int value) { calculateOpcode(Numbers.valueOf(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(long value) { calculateOpcode(Numbers.valueOf(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(int value) { calculateOpcode(Numbers.valueOf(value), false, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(Class value) { if (value == null) return setNull(); calculateOpcode(value.getName(), true, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(Class value) { if (value == null) return setNull(); calculateOpcode(value.getName(), true, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(BCClass value) { if (value == null) return setNull(); calculateOpcode(value.getName(), true, false); return this; }
/** * Set the value of this constant. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(BCClass value) { if (value == null) return setNull(); calculateOpcode(value.getName(), true, false); return this; }
void read(Instruction orig) { super.read(orig); ConstantInstruction ci = (ConstantInstruction) orig; calculateOpcode(ci.getValue(), Class.class.getName().equals(ci.getTypeName()), ci.getOpcode() == Constants.LDCW); }
void read(Instruction orig) { super.read(orig); ConstantInstruction ci = (ConstantInstruction) orig; calculateOpcode(ci.getValue(), Class.class.getName().equals(ci.getTypeName()), ci.getOpcode() == Constants.LDCW); }
/** * Set the constant to the given value. The value should be * an instance of String, Integer, Long, Double, Float, Class, BCClass, or * null depending on the constant type. If the given value is not * supported directly, it will be converted accordingly. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(Object value) { boolean clsName = false; if (value instanceof Boolean) value = Numbers.valueOf((((Boolean) value).booleanValue()) ? 1 : 0); else if (value instanceof Character) value = Numbers.valueOf((int) ((Character) value).charValue()); else if (value instanceof Byte) value = Numbers.valueOf(((Byte) value).intValue()); else if (value instanceof Short) value = Numbers.valueOf(((Short) value).intValue()); else if (value instanceof Class) { value = ((Class) value).getName(); clsName = true; } else if (value instanceof BCClass) { value = ((BCClass) value).getName(); clsName = true; } else if (value != null && !(value instanceof Number) && !(value instanceof String)) throw new IllegalArgumentException("value = " + value); calculateOpcode(value, clsName, false); return this; }
/** * Set the constant to the given value. The value should be * an instance of String, Integer, Long, Double, Float, Class, BCClass, or * null depending on the constant type. If the given value is not * supported directly, it will be converted accordingly. * * @return this instruction, for method chaining */ public ConstantInstruction setValue(Object value) { boolean clsName = false; if (value instanceof Boolean) value = Numbers.valueOf((((Boolean) value).booleanValue()) ? 1 : 0); else if (value instanceof Character) value = Numbers.valueOf((int) ((Character) value).charValue()); else if (value instanceof Byte) value = Numbers.valueOf(((Byte) value).intValue()); else if (value instanceof Short) value = Numbers.valueOf(((Short) value).intValue()); else if (value instanceof Class) { value = ((Class) value).getName(); clsName = true; } else if (value instanceof BCClass) { value = ((BCClass) value).getName(); clsName = true; } else if (value != null && !(value instanceof Number) && !(value instanceof String)) throw new IllegalArgumentException("value = " + value); calculateOpcode(value, clsName, false); return this; }