Package org.apache.cayenne.reflect
Class FieldAccessor
- java.lang.Object
-
- org.apache.cayenne.reflect.FieldAccessor
-
- All Implemented Interfaces:
Serializable
,Accessor
public class FieldAccessor extends Object implements Accessor
A PropertyAccessor that performs direct Field access.- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FieldAccessor(Class<?> objectClass, String propertyName, Class<?> propertyType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Returns property name.Object
getValue(Object object)
Returns a property value of an object without disturbing the object fault status.protected Field
lookupFieldInHierarchy(Class<?> beanClass, String fieldName)
Recursively looks for a named field in a class hierarchy.protected Field
prepareField(Class<?> beanClass, String propertyName, Class<?> propertyType)
Finds a field for the property, ensuring that direct access via reflection is possible.void
setValue(Object object, Object newValue)
Sets a property value of an object without disturbing the object fault status.
-
-
-
Method Detail
-
getValue
public Object getValue(Object object) throws PropertyException
Description copied from interface:Accessor
Returns a property value of an object without disturbing the object fault status.- Specified by:
getValue
in interfaceAccessor
- Throws:
PropertyException
-
setValue
public void setValue(Object object, Object newValue) throws PropertyException
Description copied from interface:Accessor
Sets a property value of an object without disturbing the object fault status. Old value of the property is specified as a hint.- Specified by:
setValue
in interfaceAccessor
- Throws:
PropertyException
- Since:
- 3.0
-
prepareField
protected Field prepareField(Class<?> beanClass, String propertyName, Class<?> propertyType)
Finds a field for the property, ensuring that direct access via reflection is possible.
-
lookupFieldInHierarchy
protected Field lookupFieldInHierarchy(Class<?> beanClass, String fieldName) throws SecurityException, NoSuchFieldException
Recursively looks for a named field in a class hierarchy.
-
-