diff --git a/spring-expression/src/main/java/org/springframework/expression/IndexAccessor.java b/spring-expression/src/main/java/org/springframework/expression/IndexAccessor.java index 5d066ac65d2d..1471ad48df35 100644 --- a/spring-expression/src/main/java/org/springframework/expression/IndexAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/IndexAccessor.java @@ -26,21 +26,14 @@ * structure. Implementors are therefore free to access indexed values any way * they deem appropriate. * - *
An index accessor can optionally specify an array of target classes for - * which it should be called. However, if it returns {@code null} or an empty - * array from {@link #getSpecificTargetClasses()}, it will be called for all - * indexing operations and given a chance to determine if it can read from or - * write to the indexed structure. - * - *
Index accessors are considered to be ordered, and each will be called in - * turn. The only rule that affects the call order is that any index accessor - * which specifies explicit support for the target class via - * {@link #getSpecificTargetClasses()} will be called first, before other - * generic index accessors. + *
An index accessor can specify an array of + * {@linkplain #getSpecificTargetClasses() target classes} for which it should be + * called. See {@link TargetedAccessor} for details. * * @author Jackmiking Lee * @author Sam Brannen * @since 6.2 + * @see TargetedAccessor * @see PropertyAccessor */ public interface IndexAccessor extends TargetedAccessor { diff --git a/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java b/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java index 0be829cddc6e..84e4fe5ac1dd 100644 --- a/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java @@ -26,19 +26,13 @@ * Implementors are therefore free to access properties directly via fields, * through getters, or in any other way they deem appropriate. * - *
A property accessor can optionally specify an array of target classes for - * which it should be called. However, if it returns {@code null} from - * {@link #getSpecificTargetClasses()}, it will be called for all property - * references and given a chance to determine if it can read or write them. - * - *
Property accessors are considered to be ordered, and each will be called in - * turn. The only rule that affects the call order is that any property accessor - * which specifies explicit support for the target class via - * {@link #getSpecificTargetClasses()} will be called first, before the generic - * property accessors. + *
A property accessor can specify an array of + * {@linkplain #getSpecificTargetClasses() target classes} for which it should be + * called. See {@link TargetedAccessor} for details. * * @author Andy Clement * @since 3.0 + * @see TargetedAccessor * @see IndexAccessor */ public interface PropertyAccessor extends TargetedAccessor { diff --git a/spring-expression/src/main/java/org/springframework/expression/TargetedAccessor.java b/spring-expression/src/main/java/org/springframework/expression/TargetedAccessor.java index 88b91055f5da..6403f9ca07ba 100644 --- a/spring-expression/src/main/java/org/springframework/expression/TargetedAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/TargetedAccessor.java @@ -31,9 +31,11 @@ * *
Targeted accessors are considered to be ordered, and each will be called
* in turn. The only rule that affects the call order is that any accessor which
- * specifies explicit support for a given target class via
+ * specifies explicit support for a given target type via
* {@link #getSpecificTargetClasses()} will be called first, before other generic
- * accessors that do not specify explicit support for the given target class.
+ * accessors that do not specify support for explicit target types. In addition,
+ * accessors that support the exact target type will be called before accessors
+ * that support a supertype of the target type.
*
* @author Sam Brannen
* @since 6.2
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java
index e290102ceb57..4f1dc1e2f06d 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java
@@ -55,20 +55,23 @@ static The accessors are considered to be in an ordered list; however, in the
- * returned list any accessors that are exact matches for the input target
- * type (as opposed to 'generic' accessors that could work for any type) are
- * placed at the start of the list. In addition, if there are specific
- * accessors that exactly name the class in question and accessors that name
- * a specific class which is a supertype of the class in question, the latter
- * are put at the end of the specific accessors set and will be tried after
- * exactly matching accessors but before generic accessors.
+ * The supplied accessors are considered to be in an ordered list; however,
+ * in the returned list any accessors that are exact matches for the supplied
+ * target type are placed at the start of the list (as opposed to 'generic'
+ * accessors that could work for any target type). In addition, if there are
+ * accessors that claim support for the exact target type as well as accessors
+ * that claim support for a supertype of the target type, the latter are placed
+ * at the end of the specific accessors set and will be tried after exactly
+ * matching accessors but before generic accessors.
+ * Only matching accessors and generic accessors will be included in the
+ * returned list.
* @param targetType the type upon which element access is being attempted
* @param accessors the list of element accessors to process
* @return a list of accessors that should be tried in order to access the
* element on the specified target type, or an empty list if no suitable
* accessor could be found
* @since 6.2
+ * @see TargetedAccessor#getSpecificTargetClasses()
*/
static