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 StringgetName()Returns property name.ObjectgetValue(Object object)Returns a property value of an object without disturbing the object fault status.protected FieldlookupFieldInHierarchy(Class<?> beanClass, String fieldName)Recursively looks for a named field in a class hierarchy.protected FieldprepareField(Class<?> beanClass, String propertyName, Class<?> propertyType)Finds a field for the property, ensuring that direct access via reflection is possible.voidsetValue(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:AccessorReturns a property value of an object without disturbing the object fault status.- Specified by:
getValuein interfaceAccessor- Throws:
PropertyException
-
setValue
public void setValue(Object object, Object newValue) throws PropertyException
Description copied from interface:AccessorSets a property value of an object without disturbing the object fault status. Old value of the property is specified as a hint.- Specified by:
setValuein 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.
-
-