gov.nih.nci.caarray.util
Class PropertyAccessor
java.lang.Object
gov.nih.nci.caarray.util.PropertyAccessor
public final class PropertyAccessor
- extends java.lang.Object
Utility class representing the getter/setter pair for a property.
- Author:
- dkokotov
Constructor Summary |
PropertyAccessor(java.lang.reflect.Method getter,
java.lang.reflect.Method setter)
|
Method Summary |
java.lang.Object |
get(java.lang.Object target)
Get the value of the property of this accessor from the given object. |
java.lang.reflect.Method |
getter()
|
java.lang.Class<?> |
getType()
|
void |
set(java.lang.Object target,
java.lang.Object val)
Set the value of the property of this accessor on the given object to the given value. |
java.lang.reflect.Method |
setter()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertyAccessor
public PropertyAccessor(java.lang.reflect.Method getter,
java.lang.reflect.Method setter)
- Parameters:
getter
- the getter method for the propertysetter
- the setter method for the property
getType
public java.lang.Class<?> getType()
- Returns:
- the type of the property of this accessor
set
public void set(java.lang.Object target,
java.lang.Object val)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
- Set the value of the property of this accessor on the given object to the given value.
- Parameters:
target
- the target objectval
- the value to set the property to
- Throws:
java.lang.IllegalAccessException
- if there is an error invoking the setter
java.lang.reflect.InvocationTargetException
- if there is an error invoking the setter
get
public java.lang.Object get(java.lang.Object target)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
- Get the value of the property of this accessor from the given object.
- Parameters:
target
- the object from which to get the value of the property
- Returns:
- the property value
- Throws:
java.lang.IllegalAccessException
- if there is an error invoking the setter
java.lang.reflect.InvocationTargetException
- if there is an error invoking the setter
getter
public java.lang.reflect.Method getter()
- Returns:
- the getter method for this property
setter
public java.lang.reflect.Method setter()
- Returns:
- the setter method for this property