Class SpringELExpression
java.lang.Object
org.springframework.binding.expression.spel.SpringELExpression
- All Implemented Interfaces:
Expression
A wrapper for a Spring EL
Expression
allowing it to be used under the Spring Binding Expression abstraction.- Since:
- 2.1.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsConstructorDescriptionSpringELExpression(org.springframework.expression.Expression expression, Class<?> expectedType, EvaluationContextFactory contextFactory) Generalized constructor variant that accepts anEvaluationContextFactory.SpringELExpression(org.springframework.expression.Expression expression, Map<String, Expression> expressionVars, Class<?> expectedType, org.springframework.core.convert.ConversionService conversionService, List<org.springframework.expression.PropertyAccessor> propertyAccessors) Constructor for SpringELExpression. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidextendEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext context) Deprecated.Returns the original string used to create this expression, unmodified.Evaluate this expression in the provided context and return the result of evaluation.Class<?>getValueType(Object rootObject) Returns the most general type that can be passed to theExpression.setValue(Object, Object)method for the given context.voidSet this expression in the provided context to the value provided.toString()
-
Constructor Details
-
SpringELExpression
public SpringELExpression(org.springframework.expression.Expression expression, Map<String, Expression> expressionVars, Class<?> expectedType, org.springframework.core.convert.ConversionService conversionService, List<org.springframework.expression.PropertyAccessor> propertyAccessors) Constructor for SpringELExpression.- Parameters:
expression- a parsed Spring EL expression instance. Must not be null.expressionVars- provides a mapping between variables names and parsed Spring EL expression instances. This parameter is optional (may be null).expectedType- the target type expected from the evaluation of the expression or null. This parameter is optional (may be null).conversionService- the Spring ConversionService instance to use for type conversionpropertyAccessors- propertyAccessors for Spring EL to use when evaluating expressions
-
SpringELExpression
public SpringELExpression(org.springframework.expression.Expression expression, Class<?> expectedType, EvaluationContextFactory contextFactory) Generalized constructor variant that accepts anEvaluationContextFactory.- Since:
- 2.4.8
-
-
Method Details
-
getExpressionString
Description copied from interface:ExpressionReturns the original string used to create this expression, unmodified.- Specified by:
getExpressionStringin interfaceExpression- Returns:
- the original expression string
-
getValue
Description copied from interface:ExpressionEvaluate this expression in the provided context and return the result of evaluation.- Specified by:
getValuein interfaceExpression- Parameters:
rootObject- the context to evaluate this expression in- Returns:
- the evaluation result
- Throws:
EvaluationException- an exception occurred during expression evaluation
-
getValueType
Description copied from interface:ExpressionReturns the most general type that can be passed to theExpression.setValue(Object, Object)method for the given context.- Specified by:
getValueTypein interfaceExpression- Parameters:
rootObject- the context to evaluate- Returns:
- the most general type of value that can be set on this context, or
nullif the type information cannot be determined - Throws:
EvaluationException- an exception occurred during expression evaluation
-
setValue
Description copied from interface:ExpressionSet this expression in the provided context to the value provided.- Specified by:
setValuein interfaceExpression- Parameters:
rootObject- the context on which the new value should be setvalue- the new value to set- Throws:
EvaluationException- an exception occurred during expression evaluation
-
extendEvaluationContext
@Deprecated protected void extendEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext context) Deprecated.as of 2.4.8, to customize the context, please use the constructor that accepts anEvaluationContextFactory.Invoked every time an evaluation context is created allowing further initialization from sub-classes. -
toString
-
EvaluationContextFactory.