/** * Finds and returns the Object value of a given field named {@code name} in * the receiver. If the field has not been assigned any value yet, the * default value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public Object get(String name, Object defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, null); return slot.defaulted ? defaultValue : slot.fieldValue; }
/** * Find and set the double value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, double value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, double.class); slot.fieldValue = Double.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the float value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, float value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, float.class); slot.fieldValue = Float.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the short value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, short value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, short.class); slot.fieldValue = Short.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the int value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, int value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, int.class); slot.fieldValue = Integer.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the boolean value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, boolean value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, boolean.class); slot.fieldValue = Boolean.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the long value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, long value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, long.class); slot.fieldValue = Long.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the byte value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, byte value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, byte.class); slot.fieldValue = Byte.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the char value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, char value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, char.class); slot.fieldValue = Character.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Finds and returns the long value of a given field named {@code name} in the * receiver. If the field has not been assigned any value yet, the default * value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public long get(String name, long defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, long.class); return slot.defaulted ? defaultValue : ((Long) slot.fieldValue).longValue(); }
/** * Finds and returns the double value of a given field named {@code name} * in the receiver. If the field has not been assigned any value yet, the * default value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public double get(String name, double defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, double.class); return slot.defaulted ? defaultValue : ((Double) slot.fieldValue).doubleValue(); }
/** * Finds and returns the int value of a given field named {@code name} in the * receiver. If the field has not been assigned any value yet, the default * value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public int get(String name, int defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, int.class); return slot.defaulted ? defaultValue : ((Integer) slot.fieldValue).intValue(); }
/** * Finds and returns the byte value of a given field named {@code name} * in the receiver. If the field has not been assigned any value yet, the * default value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public byte get(String name, byte defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, byte.class); return slot.defaulted ? defaultValue : ((Byte) slot.fieldValue).byteValue(); }
/** * Finds and returns the char value of a given field named {@code name} in the * receiver. If the field has not been assigned any value yet, the default * value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public char get(String name, char defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, char.class); return slot.defaulted ? defaultValue : ((Character) slot.fieldValue).charValue(); }
/** * Finds and returns the float value of a given field named {@code name} in * the receiver. If the field has not been assigned any value yet, the * default value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public float get(String name, float defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, float.class); return slot.defaulted ? defaultValue : ((Float) slot.fieldValue).floatValue(); }
/** * Finds and returns the boolean value of a given field named {@code name} in * the receiver. If the field has not been assigned any value yet, the * default value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public boolean get(String name, boolean defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, boolean.class); return slot.defaulted ? defaultValue : ((Boolean) slot.fieldValue).booleanValue(); }
/** * Finds and returns the short value of a given field named {@code name} in * the receiver. If the field has not been assigned any value yet, the * default value {@code defaultValue} is returned instead. * * @param name * the name of the field to find. * @param defaultValue * return value in case the field has not been assigned to yet. * @return the value of the given field if it has been assigned, the default * value otherwise. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public short get(String name, short defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, short.class); return slot.defaulted ? defaultValue : ((Short) slot.fieldValue).shortValue(); }
/** * Find and set the Object value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, Object value) throws IllegalArgumentException { Class<?> valueClass = null; if (value != null) { valueClass = value.getClass(); } ObjectSlot slot = findMandatorySlot(name, valueClass); slot.fieldValue = value; slot.defaulted = false; // No longer default value }
/** * Find and set the char value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, char value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, char.class); slot.fieldValue = Character.valueOf(value); slot.defaulted = false; // No longer default value }
/** * Find and set the int value of a given field named {@code name} in the * receiver. * * @param name * the name of the field to set. * @param value * new value for the field. * * @throws IllegalArgumentException * if the corresponding field can not be found. */ public void put(String name, int value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, int.class); slot.fieldValue = Integer.valueOf(value); slot.defaulted = false; // No longer default value }