Skip to content

Commit e50383e

Browse files
committed
Improve Javadoc for SpEL's Expression API
1 parent f854800 commit e50383e

File tree

1 file changed

+33
-28
lines changed
  • spring-expression/src/main/java/org/springframework/expression

1 file changed

+33
-28
lines changed

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

+33-28
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ public interface Expression {
4040
String getExpressionString();
4141

4242
/**
43-
* Evaluate this expression in the default standard context.
43+
* Evaluate this expression in the default context and return the result of evaluation.
4444
* @return the evaluation result
4545
* @throws EvaluationException if there is a problem during evaluation
4646
*/
4747
@Nullable
4848
Object getValue() throws EvaluationException;
4949

5050
/**
51-
* Evaluate this expression in the default context. If the result
52-
* of the evaluation does not match (and cannot be converted to)
51+
* Evaluate this expression in the default context and return the result of evaluation.
52+
* <p>If the result of the evaluation does not match (and cannot be converted to)
5353
* the expected result type then an exception will be thrown.
5454
* @param desiredResultType the type the caller would like the result to be
5555
* @return the evaluation result
@@ -59,7 +59,8 @@ public interface Expression {
5959
<T> T getValue(@Nullable Class<T> desiredResultType) throws EvaluationException;
6060

6161
/**
62-
* Evaluate this expression against the specified root object.
62+
* Evaluate this expression in the default context against the specified root object
63+
* and return the result of evaluation.
6364
* @param rootObject the root object against which to evaluate the expression
6465
* @return the evaluation result
6566
* @throws EvaluationException if there is a problem during evaluation
@@ -68,9 +69,10 @@ public interface Expression {
6869
Object getValue(@Nullable Object rootObject) throws EvaluationException;
6970

7071
/**
71-
* Evaluate this expression in the default context against the specified root
72-
* object. If the result of the evaluation does not match (and cannot be
73-
* converted to) the expected result type then an exception will be thrown.
72+
* Evaluate this expression in the default context against the specified root object
73+
* and return the result of evaluation.
74+
* <p>If the result of the evaluation does not match (and cannot be converted to)
75+
* the expected result type then an exception will be thrown.
7476
* @param rootObject the root object against which to evaluate the expression
7577
* @param desiredResultType the type the caller would like the result to be
7678
* @return the evaluation result
@@ -81,8 +83,7 @@ <T> T getValue(@Nullable Object rootObject, @Nullable Class<T> desiredResultType
8183
throws EvaluationException;
8284

8385
/**
84-
* Evaluate this expression in the provided context and return the result
85-
* of evaluation.
86+
* Evaluate this expression in the provided context and return the result of evaluation.
8687
* @param context the context in which to evaluate the expression
8788
* @return the evaluation result
8889
* @throws EvaluationException if there is a problem during evaluation
@@ -91,9 +92,10 @@ <T> T getValue(@Nullable Object rootObject, @Nullable Class<T> desiredResultType
9192
Object getValue(EvaluationContext context) throws EvaluationException;
9293

9394
/**
94-
* Evaluate this expression in the provided context and return the result
95-
* of evaluation, but use the supplied root context as an override for any
96-
* default root object specified in the context.
95+
* Evaluate this expression in the provided context against the specified root object
96+
* and return the result of evaluation.
97+
* <p>The supplied root object will be used as an override for any default root object
98+
* configured in the context.
9799
* @param context the context in which to evaluate the expression
98100
* @param rootObject the root object against which to evaluate the expression
99101
* @return the evaluation result
@@ -103,10 +105,9 @@ <T> T getValue(@Nullable Object rootObject, @Nullable Class<T> desiredResultType
103105
Object getValue(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException;
104106

105107
/**
106-
* Evaluate this expression in the provided context which can resolve references
107-
* to properties, methods, types, etc. The type of the evaluation result is
108-
* expected to be of a particular type, and an exception will be thrown if it
109-
* is not and cannot be converted to that type.
108+
* Evaluate this expression in the provided context and return the result of evaluation.
109+
* <p>If the result of the evaluation does not match (and cannot be converted to)
110+
* the expected result type then an exception will be thrown.
110111
* @param context the context in which to evaluate the expression
111112
* @param desiredResultType the type the caller would like the result to be
112113
* @return the evaluation result
@@ -117,11 +118,12 @@ <T> T getValue(EvaluationContext context, @Nullable Class<T> desiredResultType)
117118
throws EvaluationException;
118119

119120
/**
120-
* Evaluate this expression in the provided context which can resolve references
121-
* to properties, methods, types, etc. The type of the evaluation result is
122-
* expected to be of a particular type, and an exception will be thrown if it
123-
* is not and cannot be converted to that type.j
124-
* <p>The supplied root object overrides any specified in the supplied context.
121+
* Evaluate this expression in the provided context against the specified root object
122+
* and return the result of evaluation.
123+
* <p>The supplied root object will be used as an override for any default root object
124+
* configured in the context.
125+
* <p>If the result of the evaluation does not match (and cannot be converted to)
126+
* the expected result type then an exception will be thrown.
125127
* @param context the context in which to evaluate the expression
126128
* @param rootObject the root object against which to evaluate the expression
127129
* @param desiredResultType the type the caller would like the result to be
@@ -163,9 +165,9 @@ <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable
163165

164166
/**
165167
* Return the most general type that can be passed to the
166-
* {@link #setValue(EvaluationContext, Object, Object)} method for the given
167-
* context.
168-
* <p>The supplied root object overrides any specified in the supplied context.
168+
* {@link #setValue(EvaluationContext, Object, Object)} method for the given context.
169+
* <p>The supplied root object will be used as an override for any default root object
170+
* configured in the context.
169171
* @param context the context in which to evaluate the expression
170172
* @param rootObject the root object against which to evaluate the expression
171173
* @return the most general type of value that can be set in this context
@@ -207,7 +209,8 @@ <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable
207209
* Return a descriptor for the most general type that can be passed to the
208210
* {@link #setValue(EvaluationContext, Object, Object)} method for the given
209211
* context.
210-
* <p>The supplied root object overrides any specified in the supplied context.
212+
* <p>The supplied root object will be used as an override for any default root object
213+
* configured in the context.
211214
* @param context the context in which to evaluate the expression
212215
* @param rootObject the root object against which to evaluate the expression
213216
* @return a type descriptor for values that can be set in this context
@@ -235,7 +238,8 @@ TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Objec
235238

236239
/**
237240
* Determine if this expression can be written to, i.e. setValue() can be called.
238-
* <p>The supplied root object overrides any specified in the supplied context.
241+
* <p>The supplied root object will be used as an override for any default root object
242+
* configured in the context.
239243
* @param context the context in which the expression should be checked
240244
* @param rootObject the root object against which to evaluate the expression
241245
* @return {@code true} if the expression is writable; {@code false} otherwise
@@ -244,7 +248,7 @@ TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Objec
244248
boolean isWritable(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException;
245249

246250
/**
247-
* Set this expression in the provided context to the value provided.
251+
* Set this expression in the default context to the value provided.
248252
* @param rootObject the root object against which to evaluate the expression
249253
* @param value the new value
250254
* @throws EvaluationException if there is a problem during evaluation
@@ -261,7 +265,8 @@ TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Objec
261265

262266
/**
263267
* Set this expression in the provided context to the value provided.
264-
* <p>The supplied root object overrides any specified in the supplied context.
268+
* <p>The supplied root object will be used as an override for any default root object
269+
* configured in the context.
265270
* @param context the context in which to set the value of the expression
266271
* @param rootObject the root object against which to evaluate the expression
267272
* @param value the new value

0 commit comments

Comments
 (0)