Package org.springframework.expression
Interface IndexAccessor
- All Superinterfaces:
- TargetedAccessor
- All Known Subinterfaces:
- CompilableIndexAccessor
- All Known Implementing Classes:
- ReflectiveIndexAccessor
An index accessor is able to read from and possibly write to an indexed
 structure of a target object.
 
This interface places no restrictions on what constitutes an indexed structure. Implementors are therefore free to access indexed values any way they deem appropriate.
An index accessor can specify an array of
 target classes for which it should be
 called. See TargetedAccessor for details.
- Since:
- 6.2
- Author:
- Jackmiking Lee, Sam Brannen
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanRead(EvaluationContext context, Object target, Object index) Determine if this index accessor is able to read a specified index on a specified target object.booleancanWrite(EvaluationContext context, Object target, Object index) Determine if this index accessor is able to write to a specified index on a specified target object.read(EvaluationContext context, Object target, Object index) Read an index from a specified target object.voidWrite to an index on a specified target object.Methods inherited from interface org.springframework.expression.TargetedAccessorgetSpecificTargetClasses
- 
Method Details- 
canReadDetermine if this index accessor is able to read a specified index on a specified target object.- Parameters:
- context- the evaluation context in which the access is being attempted
- target- the target object upon which the index is being accessed
- index- the index being accessed
- Returns:
- trueif this index accessor is able to read the index
- Throws:
- AccessException- if there is any problem determining whether the index can be read
 
- 
readRead an index from a specified target object.Should only be invoked if canRead(org.springframework.expression.EvaluationContext, java.lang.Object, java.lang.Object)returnstruefor the same arguments.- Parameters:
- context- the evaluation context in which the access is being attempted
- target- the target object upon which the index is being accessed
- index- the index being accessed
- Returns:
- a TypedValue object wrapping the index value read and a type descriptor for the value
- Throws:
- AccessException- if there is any problem reading the index
 
- 
canWriteDetermine if this index accessor is able to write to a specified index on a specified target object.- Parameters:
- context- the evaluation context in which the access is being attempted
- target- the target object upon which the index is being accessed
- index- the index being accessed
- Returns:
- trueif this index accessor is able to write to the index
- Throws:
- AccessException- if there is any problem determining whether the index can be written to
 
- 
writevoid write(EvaluationContext context, Object target, Object index, @Nullable Object newValue) throws AccessException Write to an index on a specified target object.Should only be invoked if canWrite(org.springframework.expression.EvaluationContext, java.lang.Object, java.lang.Object)returnstruefor the same arguments.- Parameters:
- context- the evaluation context in which the access is being attempted
- target- the target object upon which the index is being accessed
- index- the index being accessed
- newValue- the new value for the index
- Throws:
- AccessException- if there is any problem writing to the index
 
 
-