Class DataBindingPropertyAccessor
- java.lang.Object
- org.springframework.expression.spel.support.ReflectivePropertyAccessor
- org.springframework.expression.spel.support.DataBindingPropertyAccessor
- All Implemented Interfaces:
PropertyAccessor
public class DataBindingPropertyAccessor extends ReflectivePropertyAccessor
APropertyAccessor
variant for data binding purposes, using reflection to access properties for reading and possibly writing.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.
This accessor is explicitly designed for user-declared properties and does not resolve technical properties on
java.lang.Object
orjava.lang.Class
. For unrestricted resolution, chooseReflectivePropertyAccessor
instead.- Since:
- 4.3.15
- Author:
- Juergen Hoeller
- See Also:
forReadOnlyAccess()
,forReadWriteAccess()
,SimpleEvaluationContext
,StandardEvaluationContext
,ReflectivePropertyAccessor
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.expression.spel.support.ReflectivePropertyAccessor
ReflectivePropertyAccessor.OptimalPropertyAccessor
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataBindingPropertyAccessor
forReadOnlyAccess()
Create a new data-binding property accessor for read-only operations.static DataBindingPropertyAccessor
forReadWriteAccess()
Create a new data-binding property accessor for read-write operations.protected boolean
isCandidateForProperty(Method method, Class<?> targetClass)
Determine whether the givenMethod
is a candidate for property access on an instance of the given target class.Methods inherited from class org.springframework.expression.spel.support.ReflectivePropertyAccessor
canRead, canWrite, createOptimalAccessor, findField, findGetterForProperty, findSetterForProperty, getLastReadInvokerPair, getPropertyMethodSuffix, getPropertyMethodSuffixes, getSpecificTargetClasses, read, write
Method Detail
isCandidateForProperty
protected boolean isCandidateForProperty(Method method, Class<?> targetClass)
Description copied from class:ReflectivePropertyAccessor
Determine whether the givenMethod
is a candidate for property access on an instance of the given target class.The default implementation considers any method as a candidate, even for non-user-declared properties on the
Object
base class.- Overrides:
isCandidateForProperty
in classReflectivePropertyAccessor
- Parameters:
method
- the Method to evaluatetargetClass
- the concrete target class that is being introspected
forReadOnlyAccess
public static DataBindingPropertyAccessor forReadOnlyAccess()
Create a new data-binding property accessor for read-only operations.
forReadWriteAccess
public static DataBindingPropertyAccessor forReadWriteAccess()
Create a new data-binding property accessor for read-write operations.