Class ExpressionUtils
java.lang.Object
org.springframework.integration.expression.ExpressionUtils
Utility class with static methods for helping with evaluation of SpEL expressions.
- Since:
- 2.2
- Author:
- Gary Russell, Oleg Zhurakousky, Artem Bilan
-
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleEvaluationContext
Used to create a context with no BeanFactory, usually in tests.static SimpleEvaluationContext
createSimpleEvaluationContext
(BeanFactory beanFactory) Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.static StandardEvaluationContext
Used to create a context with no BeanFactory, usually in tests.static StandardEvaluationContext
createStandardEvaluationContext
(BeanFactory beanFactory) Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.static File
expressionToFile
(Expression expression, EvaluationContext evaluationContext, Message<?> message, String propertyName) static Expression
intExpression
(String expression) Return aValueExpression
for a simple literal, otherwise aSpelExpression
.static Expression
longExpression
(String expression) Return aValueExpression
for a simple literal, otherwise aSpelExpression
.
-
Method Details
-
createStandardEvaluationContext
Used to create a context with no BeanFactory, usually in tests.- Returns:
- The evaluation context.
-
createSimpleEvaluationContext
Used to create a context with no BeanFactory, usually in tests.- Returns:
- The evaluation context.
- Since:
- 4.3.15
-
createStandardEvaluationContext
public static StandardEvaluationContext createStandardEvaluationContext(@Nullable BeanFactory beanFactory) Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.- Parameters:
beanFactory
- The bean factory.- Returns:
- The evaluation context.
-
createSimpleEvaluationContext
public static SimpleEvaluationContext createSimpleEvaluationContext(@Nullable BeanFactory beanFactory) Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.- Parameters:
beanFactory
- The bean factory.- Returns:
- The evaluation context.
- Since:
- 4.3.15
-
expressionToFile
public static File expressionToFile(Expression expression, EvaluationContext evaluationContext, @Nullable Message<?> message, String propertyName) - Parameters:
expression
- the expression.evaluationContext
- the evaluation context.message
- the message (if available).propertyName
- the property name the expression is evaluated for.- Returns:
- the File.
- Since:
- 5.0
-
intExpression
Return aValueExpression
for a simple literal, otherwise aSpelExpression
.- Parameters:
expression
- the expression string.- Returns:
- the expression.
- Since:
- 5.0
-
longExpression
Return aValueExpression
for a simple literal, otherwise aSpelExpression
.- Parameters:
expression
- the expression string.- Returns:
- the expression.
- Since:
- 5.0
-