Fix wording in SpEL's PropertyAccessor Javadoc
The documentation now properly refers to "property accessors" instead of "resolvers".
This commit is contained in:
parent
7c009ccc1f
commit
57632f9f08
|
@ -34,7 +34,7 @@ package org.springframework.expression;
|
|||
* @author Andy Clement
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
* @see ConstructorResolver
|
||||
* @see MethodResolver
|
||||
* @see MethodExecutor
|
||||
*/
|
||||
@FunctionalInterface
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -19,20 +19,23 @@ package org.springframework.expression;
|
|||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A property accessor is able to read from (and possibly write to) an object's properties.
|
||||
* A property accessor is able to read from (and possibly write to) an object's
|
||||
* properties.
|
||||
*
|
||||
* <p>This interface places no restrictions, and so implementors are free to access properties
|
||||
* directly as fields or through getters or in any other way they see as appropriate.
|
||||
* <p>This interface places no restrictions on what constitutes a property.
|
||||
* Implementors are therefore free to access properties directly via fields,
|
||||
* through getters, or in any other way they deem appropriate.
|
||||
*
|
||||
* <p>A resolver 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.
|
||||
* <p>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.
|
||||
*
|
||||
* <p>Property resolvers are considered to be ordered, and each will be called in turn.
|
||||
* The only rule that affects the call order is that any resolver naming the target
|
||||
* class directly in {@link #getSpecificTargetClasses()} will be called first, before
|
||||
* the general resolvers.
|
||||
* <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 general
|
||||
* property accessors.
|
||||
*
|
||||
* @author Andy Clement
|
||||
* @since 3.0
|
||||
|
@ -40,44 +43,46 @@ import org.springframework.lang.Nullable;
|
|||
public interface PropertyAccessor {
|
||||
|
||||
/**
|
||||
* Return an array of classes for which this resolver should be called.
|
||||
* <p>Returning {@code null} indicates this is a general resolver that
|
||||
* Return an array of classes for which this property accessor should be called.
|
||||
* <p>Returning {@code null} indicates this is a general property accessor that
|
||||
* can be called in an attempt to resolve a property on any type.
|
||||
* @return an array of classes that this resolver is suitable for
|
||||
* (or {@code null} if a general resolver)
|
||||
* @return an array of classes that this property accessor is suitable for
|
||||
* (or {@code null} if a general property accessor)
|
||||
*/
|
||||
@Nullable
|
||||
Class<?>[] getSpecificTargetClasses();
|
||||
|
||||
/**
|
||||
* Called to determine if a resolver instance is able to access a specified property
|
||||
* on a specified target object.
|
||||
* Called to determine if this property accessor is able to read a specified
|
||||
* property on a specified target object.
|
||||
* @param context the evaluation context in which the access is being attempted
|
||||
* @param target the target object upon which the property is being accessed
|
||||
* @param name the name of the property being accessed
|
||||
* @return true if this resolver is able to read the property
|
||||
* @throws AccessException if there is any problem determining whether the property can be read
|
||||
* @return true if this property accessor is able to read the property
|
||||
* @throws AccessException if there is any problem determining whether the
|
||||
* property can be read
|
||||
*/
|
||||
boolean canRead(EvaluationContext context, @Nullable Object target, String name) throws AccessException;
|
||||
|
||||
/**
|
||||
* Called to read a property from a specified target object.
|
||||
* Should only succeed if {@link #canRead} also returns {@code true}.
|
||||
* <p>Should only succeed if {@link #canRead} also returns {@code true}.
|
||||
* @param context the evaluation context in which the access is being attempted
|
||||
* @param target the target object upon which the property is being accessed
|
||||
* @param name the name of the property being accessed
|
||||
* @return a TypedValue object wrapping the property value read and a type descriptor for it
|
||||
* @throws AccessException if there is any problem accessing the property value
|
||||
* @return a TypedValue object wrapping the property value read and a type
|
||||
* descriptor for it
|
||||
* @throws AccessException if there is any problem reading the property value
|
||||
*/
|
||||
TypedValue read(EvaluationContext context, @Nullable Object target, String name) throws AccessException;
|
||||
|
||||
/**
|
||||
* Called to determine if a resolver instance is able to write to a specified
|
||||
* Called to determine if this property accessor is able to write to a specified
|
||||
* property on a specified target object.
|
||||
* @param context the evaluation context in which the access is being attempted
|
||||
* @param target the target object upon which the property is being accessed
|
||||
* @param name the name of the property being accessed
|
||||
* @return true if this resolver is able to write to the property
|
||||
* @return true if this property accessor is able to write to the property
|
||||
* @throws AccessException if there is any problem determining whether the
|
||||
* property can be written to
|
||||
*/
|
||||
|
@ -85,7 +90,7 @@ public interface PropertyAccessor {
|
|||
|
||||
/**
|
||||
* Called to write to a property on a specified target object.
|
||||
* Should only succeed if {@link #canWrite} also returns {@code true}.
|
||||
* <p>Should only succeed if {@link #canWrite} also returns {@code true}.
|
||||
* @param context the evaluation context in which the access is being attempted
|
||||
* @param target the target object upon which the property is being accessed
|
||||
* @param name the name of the property being accessed
|
||||
|
|
Loading…
Reference in New Issue