Skip to content

Commit 61fcef1

Browse files
committed
polishing
1 parent 34ebad5 commit 61fcef1

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 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,10 +19,11 @@
1919
import org.springframework.core.convert.TypeDescriptor;
2020

2121
/**
22-
* An expression capable of evaluating itself against context objects. Encapsulates the details of a previously parsed
23-
* expression string. Provides a common abstraction for expression evaluation independent of any language like OGNL or
24-
* the Unified EL.
25-
*
22+
* An expression capable of evaluating itself against context objects.
23+
* Encapsulates the details of a previously parsed expression string.
24+
* Provides a common abstraction for expression evaluation independent
25+
* of any language like OGNL or the Unified EL.
26+
*
2627
* @author Keith Donald
2728
* @author Andy Clement
2829
* @since 3.0
@@ -31,15 +32,13 @@ public interface Expression {
3132

3233
/**
3334
* Evaluate this expression in the default standard context.
34-
*
3535
* @return the evaluation result
3636
* @throws EvaluationException if there is a problem during evaluation
3737
*/
3838
Object getValue() throws EvaluationException;
3939

4040
/**
4141
* Evaluate this expression against the specified root object
42-
*
4342
* @param rootObject the root object against which properties/etc will be resolved
4443
* @return the evaluation result
4544
* @throws EvaluationException if there is a problem during evaluation
@@ -49,7 +48,6 @@ public interface Expression {
4948
/**
5049
* Evaluate the expression in the default context. If the result of the evaluation does not match (and
5150
* cannot be converted to) the expected result type then an exception will be returned.
52-
*
5351
* @param desiredResultType the class the caller would like the result to be
5452
* @return the evaluation result
5553
* @throws EvaluationException if there is a problem during evaluation
@@ -60,7 +58,6 @@ public interface Expression {
6058
* Evaluate the expression in the default context against the specified root object. If the
6159
* result of the evaluation does not match (and cannot be converted to) the expected result type
6260
* then an exception will be returned.
63-
*
6461
* @param rootObject the root object against which properties/etc will be resolved
6562
* @param desiredResultType the class the caller would like the result to be
6663
* @return the evaluation result
@@ -70,7 +67,6 @@ public interface Expression {
7067

7168
/**
7269
* Evaluate this expression in the provided context and return the result of evaluation.
73-
*
7470
* @param context the context in which to evaluate the expression
7571
* @return the evaluation result
7672
* @throws EvaluationException if there is a problem during evaluation
@@ -80,7 +76,6 @@ public interface Expression {
8076
/**
8177
* Evaluate this expression in the provided context and return the result of evaluation, but use
8278
* the supplied root context as an override for any default root object specified in the context.
83-
*
8479
* @param context the context in which to evaluate the expression
8580
* @param rootObject the root object against which properties/etc will be resolved
8681
* @return the evaluation result
@@ -92,7 +87,6 @@ public interface Expression {
9287
* Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc -
9388
* the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it
9489
* is not and cannot be converted to that type.
95-
*
9690
* @param context the context in which to evaluate the expression
9791
* @param desiredResultType the class the caller would like the result to be
9892
* @return the evaluation result
@@ -105,7 +99,6 @@ public interface Expression {
10599
* the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it
106100
* is not and cannot be converted to that type. The supplied root object overrides any default specified on the
107101
* supplied context.
108-
*
109102
* @param context the context in which to evaluate the expression
110103
* @param rootObject the root object against which properties/etc will be resolved
111104
* @param desiredResultType the class the caller would like the result to be
@@ -115,9 +108,8 @@ public interface Expression {
115108
<T> T getValue(EvaluationContext context, Object rootObject, Class<T> desiredResultType) throws EvaluationException;
116109

117110
/**
118-
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
119-
* the default context.
120-
*
111+
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)}
112+
* method using the default context.
121113
* @return the most general type of value that can be set on this context
122114
* @throws EvaluationException if there is a problem determining the type
123115
*/

org.springframework.expression/src/main/java/org/springframework/expression/common/ExpressionUtils.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 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.
@@ -42,8 +42,7 @@ public abstract class ExpressionUtils {
4242
* @throws EvaluationException if there is a problem during conversion or conversion of the value to the specified
4343
* type is not supported
4444
*/
45-
public static <T> T convert(EvaluationContext context, Object value, Class<T> targetType)
46-
throws EvaluationException {
45+
public static <T> T convert(EvaluationContext context, Object value, Class<T> targetType) throws EvaluationException {
4746
// TODO remove this function over time and use the one it delegates to
4847
return convertTypedValue(context,new TypedValue(value,TypeDescriptor.forObject(value)),targetType);
4948
}
@@ -61,7 +60,6 @@ public static <T> T convert(EvaluationContext context, Object value, Class<T> ta
6160
@SuppressWarnings("unchecked")
6261
public static <T> T convertTypedValue(EvaluationContext context, TypedValue typedValue, Class<T> targetType) {
6362
Object value = typedValue.getValue();
64-
6563
if (targetType == null || ClassUtils.isAssignableValue(targetType, value)) {
6664
return (T) value;
6765
}

0 commit comments

Comments
 (0)