Skip to content

Commit 57632f9

Browse files
committed
Fix wording in SpEL's PropertyAccessor Javadoc
The documentation now properly refers to "property accessors" instead of "resolvers".
1 parent 7c009cc commit 57632f9

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

spring-expression/src/main/java/org/springframework/expression/ConstructorExecutor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @author Andy Clement
3535
* @author Sam Brannen
3636
* @since 3.0
37-
* @see ConstructorResolver
37+
* @see MethodResolver
3838
* @see MethodExecutor
3939
*/
4040
@FunctionalInterface

spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java

+31-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,73 +19,78 @@
1919
import org.springframework.lang.Nullable;
2020

2121
/**
22-
* A property accessor is able to read from (and possibly write to) an object's properties.
22+
* A property accessor is able to read from (and possibly write to) an object's
23+
* properties.
2324
*
24-
* <p>This interface places no restrictions, and so implementors are free to access properties
25-
* directly as fields or through getters or in any other way they see as appropriate.
25+
* <p>This interface places no restrictions on what constitutes a property.
26+
* Implementors are therefore free to access properties directly via fields,
27+
* through getters, or in any other way they deem appropriate.
2628
*
27-
* <p>A resolver can optionally specify an array of target classes for which it should be
28-
* called. However, if it returns {@code null} from {@link #getSpecificTargetClasses()},
29-
* it will be called for all property references and given a chance to determine if it
30-
* can read or write them.
29+
* <p>A property accessor can optionally specify an array of target classes for
30+
* which it should be called. However, if it returns {@code null} from
31+
* {@link #getSpecificTargetClasses()}, it will be called for all property
32+
* references and given a chance to determine if it can read or write them.
3133
*
32-
* <p>Property resolvers are considered to be ordered, and each will be called in turn.
33-
* The only rule that affects the call order is that any resolver naming the target
34-
* class directly in {@link #getSpecificTargetClasses()} will be called first, before
35-
* the general resolvers.
34+
* <p>Property accessors are considered to be ordered, and each will be called in
35+
* turn. The only rule that affects the call order is that any property accessor
36+
* which specifies explicit support for the target class via
37+
* {@link #getSpecificTargetClasses()} will be called first, before the general
38+
* property accessors.
3639
*
3740
* @author Andy Clement
3841
* @since 3.0
3942
*/
4043
public interface PropertyAccessor {
4144

4245
/**
43-
* Return an array of classes for which this resolver should be called.
44-
* <p>Returning {@code null} indicates this is a general resolver that
46+
* Return an array of classes for which this property accessor should be called.
47+
* <p>Returning {@code null} indicates this is a general property accessor that
4548
* can be called in an attempt to resolve a property on any type.
46-
* @return an array of classes that this resolver is suitable for
47-
* (or {@code null} if a general resolver)
49+
* @return an array of classes that this property accessor is suitable for
50+
* (or {@code null} if a general property accessor)
4851
*/
4952
@Nullable
5053
Class<?>[] getSpecificTargetClasses();
5154

5255
/**
53-
* Called to determine if a resolver instance is able to access a specified property
54-
* on a specified target object.
56+
* Called to determine if this property accessor is able to read a specified
57+
* property on a specified target object.
5558
* @param context the evaluation context in which the access is being attempted
5659
* @param target the target object upon which the property is being accessed
5760
* @param name the name of the property being accessed
58-
* @return true if this resolver is able to read the property
59-
* @throws AccessException if there is any problem determining whether the property can be read
61+
* @return true if this property accessor is able to read the property
62+
* @throws AccessException if there is any problem determining whether the
63+
* property can be read
6064
*/
6165
boolean canRead(EvaluationContext context, @Nullable Object target, String name) throws AccessException;
6266

6367
/**
6468
* Called to read a property from a specified target object.
65-
* Should only succeed if {@link #canRead} also returns {@code true}.
69+
* <p>Should only succeed if {@link #canRead} also returns {@code true}.
6670
* @param context the evaluation context in which the access is being attempted
6771
* @param target the target object upon which the property is being accessed
6872
* @param name the name of the property being accessed
69-
* @return a TypedValue object wrapping the property value read and a type descriptor for it
70-
* @throws AccessException if there is any problem accessing the property value
73+
* @return a TypedValue object wrapping the property value read and a type
74+
* descriptor for it
75+
* @throws AccessException if there is any problem reading the property value
7176
*/
7277
TypedValue read(EvaluationContext context, @Nullable Object target, String name) throws AccessException;
7378

7479
/**
75-
* Called to determine if a resolver instance is able to write to a specified
80+
* Called to determine if this property accessor is able to write to a specified
7681
* property on a specified target object.
7782
* @param context the evaluation context in which the access is being attempted
7883
* @param target the target object upon which the property is being accessed
7984
* @param name the name of the property being accessed
80-
* @return true if this resolver is able to write to the property
85+
* @return true if this property accessor is able to write to the property
8186
* @throws AccessException if there is any problem determining whether the
8287
* property can be written to
8388
*/
8489
boolean canWrite(EvaluationContext context, @Nullable Object target, String name) throws AccessException;
8590

8691
/**
8792
* Called to write to a property on a specified target object.
88-
* Should only succeed if {@link #canWrite} also returns {@code true}.
93+
* <p>Should only succeed if {@link #canWrite} also returns {@code true}.
8994
* @param context the evaluation context in which the access is being attempted
9095
* @param target the target object upon which the property is being accessed
9196
* @param name the name of the property being accessed

0 commit comments

Comments
 (0)