Class FieldVariableBinding
- java.lang.Object
-
- com.singularsys.jep.misc.boundvariable.FieldVariableBinding
-
- All Implemented Interfaces:
VariableBinding
,java.io.Serializable
public class FieldVariableBinding extends java.lang.Object implements VariableBinding
AVariableBinding
which binds variables to a particular field of an object. Uses the reflection mechanism ofClass.getField(String)
.- Since:
- Jep 3.5
- Author:
- Richard Morris
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FieldVariableBinding(java.lang.Object obj, java.lang.reflect.Field field)
Create the binding object with the name of a field.FieldVariableBinding(java.lang.Object obj, java.lang.String fieldName)
Create the binding object with the name of a field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getValue()
Gets the value of the associated field.void
setValue(java.lang.Object value)
Sets the value of the associated field.
-
-
-
Constructor Detail
-
FieldVariableBinding
public FieldVariableBinding(java.lang.Object obj, java.lang.String fieldName) throws java.lang.SecurityException, java.lang.NoSuchFieldException
Create the binding object with the name of a field.- Parameters:
obj
- the objectfieldName
- the name of the field- Throws:
java.lang.SecurityException
- if the field can not be acessed.java.lang.NoSuchFieldException
- if the field does not exists
-
FieldVariableBinding
public FieldVariableBinding(java.lang.Object obj, java.lang.reflect.Field field)
Create the binding object with the name of a field.- Parameters:
obj
- the objectfield
- a field object
-
-
Method Detail
-
getValue
public java.lang.Object getValue() throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
Gets the value of the associated field.- Specified by:
getValue
in interfaceVariableBinding
- Returns:
- the value
- Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
- See Also:
Field.get(Object)
-
setValue
public void setValue(java.lang.Object value) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
Sets the value of the associated field.- Specified by:
setValue
in interfaceVariableBinding
- Parameters:
value
- the value- Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
- See Also:
Field.set(Object, Object)
-
-