org.springframework.expression.common
Class ExpressionUtils
java.lang.Object
org.springframework.expression.common.ExpressionUtils
public abstract class ExpressionUtils
- extends Object
Common utility functions that may be used by any Expression Language provider.
- Since:
- 3.0
- Author:
- Andy Clement, Juergen Hoeller
Method Summary |
static
|
convert(EvaluationContext context,
Object value,
Class<T> targetType)
Determines if there is a type converter available in the specified context and attempts to use it to convert the
supplied value to the specified type. |
static
|
convertTypedValue(EvaluationContext context,
TypedValue typedValue,
Class<T> targetType)
Determines if there is a type converter available in the specified context and attempts to use it to convert the
supplied value to the specified type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExpressionUtils
public ExpressionUtils()
convert
public static <T> T convert(EvaluationContext context,
Object value,
Class<T> targetType)
throws EvaluationException
- Determines if there is a type converter available in the specified context and attempts to use it to convert the
supplied value to the specified type. Throws an exception if conversion is not possible.
- Parameters:
context
- the evaluation context that may define a type convertervalue
- the value to convert (may be null)targetType
- the type to attempt conversion to
- Returns:
- the converted value
- Throws:
EvaluationException
- if there is a problem during conversion or conversion of the value to the specified
type is not supported
convertTypedValue
public static <T> T convertTypedValue(EvaluationContext context,
TypedValue typedValue,
Class<T> targetType)
- Determines if there is a type converter available in the specified context and attempts to use it to convert the
supplied value to the specified type. Throws an exception if conversion is not possible.
- Parameters:
context
- the evaluation context that may define a type convertertypedValue
- the value to convert and a type descriptor describing ittargetType
- the type to attempt conversion to
- Returns:
- the converted value
- Throws:
EvaluationException
- if there is a problem during conversion or conversion of the value to the specified
type is not supported