Revise Javadoc for PropertyAccessor & IndexAccessor regarding ordering
Closes gh-33862
This commit is contained in:
parent
ae16a7fc08
commit
caec8f4f36
|
@ -26,21 +26,14 @@ import org.springframework.lang.Nullable;
|
||||||
* structure. Implementors are therefore free to access indexed values any way
|
* structure. Implementors are therefore free to access indexed values any way
|
||||||
* they deem appropriate.
|
* they deem appropriate.
|
||||||
*
|
*
|
||||||
* <p>An index accessor can optionally specify an array of target classes for
|
* <p>An index accessor can specify an array of
|
||||||
* which it should be called. However, if it returns {@code null} or an empty
|
* {@linkplain #getSpecificTargetClasses() target classes} for which it should be
|
||||||
* array from {@link #getSpecificTargetClasses()}, it will be called for all
|
* called. See {@link TargetedAccessor} for details.
|
||||||
* indexing operations and given a chance to determine if it can read from or
|
|
||||||
* write to the indexed structure.
|
|
||||||
*
|
|
||||||
* <p>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.
|
|
||||||
*
|
*
|
||||||
* @author Jackmiking Lee
|
* @author Jackmiking Lee
|
||||||
* @author Sam Brannen
|
* @author Sam Brannen
|
||||||
* @since 6.2
|
* @since 6.2
|
||||||
|
* @see TargetedAccessor
|
||||||
* @see PropertyAccessor
|
* @see PropertyAccessor
|
||||||
*/
|
*/
|
||||||
public interface IndexAccessor extends TargetedAccessor {
|
public interface IndexAccessor extends TargetedAccessor {
|
||||||
|
|
|
@ -26,19 +26,13 @@ import org.springframework.lang.Nullable;
|
||||||
* Implementors are therefore free to access properties directly via fields,
|
* Implementors are therefore free to access properties directly via fields,
|
||||||
* through getters, or in any other way they deem appropriate.
|
* through getters, or in any other way they deem appropriate.
|
||||||
*
|
*
|
||||||
* <p>A property accessor can optionally specify an array of target classes for
|
* <p>A property accessor can specify an array of
|
||||||
* which it should be called. However, if it returns {@code null} from
|
* {@linkplain #getSpecificTargetClasses() target classes} for which it should be
|
||||||
* {@link #getSpecificTargetClasses()}, it will be called for all property
|
* called. See {@link TargetedAccessor} for details.
|
||||||
* references and given a chance to determine if it can read or write them.
|
|
||||||
*
|
|
||||||
* <p>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.
|
|
||||||
*
|
*
|
||||||
* @author Andy Clement
|
* @author Andy Clement
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
|
* @see TargetedAccessor
|
||||||
* @see IndexAccessor
|
* @see IndexAccessor
|
||||||
*/
|
*/
|
||||||
public interface PropertyAccessor extends TargetedAccessor {
|
public interface PropertyAccessor extends TargetedAccessor {
|
||||||
|
|
|
@ -31,9 +31,11 @@ import org.springframework.lang.Nullable;
|
||||||
*
|
*
|
||||||
* <p>Targeted accessors are considered to be ordered, and each will be called
|
* <p>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
|
* 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
|
* {@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
|
* @author Sam Brannen
|
||||||
* @since 6.2
|
* @since 6.2
|
||||||
|
|
|
@ -55,20 +55,23 @@ abstract class AstUtils {
|
||||||
/**
|
/**
|
||||||
* Determine the set of accessors that should be used to try to access an
|
* Determine the set of accessors that should be used to try to access an
|
||||||
* element on the specified target type.
|
* element on the specified target type.
|
||||||
* <p>The accessors are considered to be in an ordered list; however, in the
|
* <p>The supplied accessors are considered to be in an ordered list; however,
|
||||||
* returned list any accessors that are exact matches for the input target
|
* in the returned list any accessors that are exact matches for the supplied
|
||||||
* type (as opposed to 'generic' accessors that could work for any type) are
|
* target type are placed at the start of the list (as opposed to 'generic'
|
||||||
* placed at the start of the list. In addition, if there are specific
|
* accessors that could work for any target type). In addition, if there are
|
||||||
* accessors that exactly name the class in question and accessors that name
|
* accessors that claim support for the exact target type as well as accessors
|
||||||
* a specific class which is a supertype of the class in question, the latter
|
* that claim support for a supertype of the target type, the latter are placed
|
||||||
* are put at the end of the specific accessors set and will be tried after
|
* at the end of the specific accessors set and will be tried after exactly
|
||||||
* exactly matching accessors but before generic accessors.
|
* matching accessors but before generic accessors.
|
||||||
|
* <p>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 targetType the type upon which element access is being attempted
|
||||||
* @param accessors the list of element accessors to process
|
* @param accessors the list of element accessors to process
|
||||||
* @return a list of accessors that should be tried in order to access the
|
* @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
|
* element on the specified target type, or an empty list if no suitable
|
||||||
* accessor could be found
|
* accessor could be found
|
||||||
* @since 6.2
|
* @since 6.2
|
||||||
|
* @see TargetedAccessor#getSpecificTargetClasses()
|
||||||
*/
|
*/
|
||||||
static <T extends TargetedAccessor> List<T> getAccessorsToTry(
|
static <T extends TargetedAccessor> List<T> getAccessorsToTry(
|
||||||
@Nullable Class<?> targetType, List<T> accessors) {
|
@Nullable Class<?> targetType, List<T> accessors) {
|
||||||
|
|
Loading…
Reference in New Issue