spring-framework / org.springframework.expression.spel.support / ReflectivePropertyAccessor

ReflectivePropertyAccessor

open class ReflectivePropertyAccessor : PropertyAccessor

Simple PropertyAccessor that uses reflection to access properties for reading and writing.

A property can be accessed through a public getter method (when being read) or a public setter method (when being written), and also as a public field.

Author
Andy Clement

Author
Juergen Hoeller

Author
Phillip Webb

Since
3.0

Constructors

<init>

ReflectivePropertyAccessor()

Simple PropertyAccessor that uses reflection to access properties for reading and writing.

A property can be accessed through a public getter method (when being read) or a public setter method (when being written), and also as a public field.

Functions

canRead

open fun canRead(context: EvaluationContext, target: Any, name: String): Boolean

canWrite

open fun canWrite(context: EvaluationContext, target: Any, name: String): Boolean

createOptimalAccessor

open fun createOptimalAccessor(evalContext: EvaluationContext, target: Any, name: String): PropertyAccessor

Attempt to create an optimized property accessor tailored for a property of a particular name on a particular class. The general ReflectivePropertyAccessor will always work but is not optimal due to the need to lookup which reflective member (method/field) to use each time read() is called. This method will just return the ReflectivePropertyAccessor instance if it is unable to build something more optimal.

getLastReadInvokerPair

open fun getLastReadInvokerPair(): Member

getSpecificTargetClasses

open fun getSpecificTargetClasses(): Array<Class<*>>

Returns null which means this is a general purpose accessor.

read

open fun read(context: EvaluationContext, target: Any, name: String): TypedValue

write

open fun write(context: EvaluationContext, target: Any, name: String, newValue: Any): Unit