PropertyAccessor that uses reflection to access properties
for reading and possibly also for writing on a target instance.
A property can be referenced through a public getter method (when being read) or a public setter method (when being written), and also as a public field.
StandardEvaluationContext, SimpleEvaluationContext, DataBindingPropertyAccessor
| Modifier and Type | Class and Description |
|---|---|
| private static record | ReflectivePropertyAccessor.
Captures the member (method/field) to call reflectively to access a property value and the type descriptor for the value returned by the reflective call. |
| private static class | ReflectivePropertyAccessor.
Inner class to avoid a hard dependency on Kotlin at runtime. |
| public static class | ReflectivePropertyAccessor.
An optimized form of a PropertyAccessor that will use reflection but only knows how to access a particular property on a particular class. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private static final Set | |
| private static final Set | |
| private volatile ReflectivePropertyAccessor. | |
| private final Map | |
| private final Map | |
| private final Map | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ReflectivePropertyAccessor(boolean
whether to allow write operations on a target instance allowWrite)Create a new property accessor for reading and possibly also writing. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canRead(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name)Implements org. Called to determine if a resolver instance is able to access a specified property on a specified target object. |
| public boolean | canWrite(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name)Implements org. Called to determine if a resolver instance is able to write to a specified property on a specified target object. |
| public PropertyAccessor | createOptimalAccessor(EvaluationContext context, Object target, String name)
Attempt to create an optimized property accessor tailored for a property of a particular name on a particular class. |
| private Field | |
| protected Field | |
| private Method | |
| protected Method | findGetterForProperty(String propertyName, Class<?> clazz, boolean mustBeStatic)
Find a getter method for the specified property. |
| private Method | |
| private Method | |
| protected Method | findSetterForProperty(String propertyName, Class<?> clazz, boolean mustBeStatic)
Find a setter method for the specified property. |
| protected String | |
| protected String[] | |
| private Method[] | getSortedMethods(Class<?> clazz)
Return class methods ordered with non-bridge methods appearing higher. |
| public Class | getSpecificTargetClasses()
Implements org. Returns |
| private TypeDescriptor | |
| protected boolean | isCandidateForProperty(Method
the Method to evaluate method, Class<?> the concrete target class that is being introspected targetClass)Determine whether the given |
| private static boolean | |
| public TypedValue | read(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name)Implements org. Called to read a property from a specified target object. |
| public void | write(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name, Object the new value for the property newValue)Implements org. Called to write to a property on a specified target object. |