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
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FieldAccessor(Class<?> objectClass, String propertyName, Class<?> propertyType)
-
Method Summary
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.
-
Field Details
-
propertyName
-
field
-
nullValue
-
-
Constructor Details
-
FieldAccessor
-
-
Method Details
-
getName
Description copied from interface:Accessor
Returns property name. -
getValue
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
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
Finds a field for the property, ensuring that direct access via reflection is possible. -
lookupFieldInHierarchy
protected Field lookupFieldInHierarchy(Class<?> beanClass, String fieldName) throws SecurityException, NoSuchFieldExceptionRecursively looks for a named field in a class hierarchy.
-