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 SummaryModifier and TypeMethodDescriptionstatic SimpleEvaluationContextUsed to create a context with no BeanFactory, usually in tests.static SimpleEvaluationContextcreateSimpleEvaluationContext(BeanFactory beanFactory) Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.static StandardEvaluationContextUsed to create a context with no BeanFactory, usually in tests.static StandardEvaluationContextcreateStandardEvaluationContext(BeanFactory beanFactory) Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.static FileexpressionToFile(Expression expression, EvaluationContext evaluationContext, Message<?> message, String propertyName) static ExpressionintExpression(String expression) Return aValueExpressionfor a simple literal, otherwise aSpelExpression.static ExpressionlongExpression(String expression) Return aValueExpressionfor a simple literal, otherwise aSpelExpression.
- 
Method Details- 
createStandardEvaluationContextUsed to create a context with no BeanFactory, usually in tests.- Returns:
- The evaluation context.
 
- 
createSimpleEvaluationContextUsed to create a context with no BeanFactory, usually in tests.- Returns:
- The evaluation context.
- Since:
- 4.3.15
 
- 
createStandardEvaluationContextpublic 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.
 
- 
createSimpleEvaluationContextpublic 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
 
- 
expressionToFilepublic 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
 
- 
intExpressionReturn aValueExpressionfor a simple literal, otherwise aSpelExpression.- Parameters:
- expression- the expression string.
- Returns:
- the expression.
- Since:
- 5.0
 
- 
longExpressionReturn aValueExpressionfor a simple literal, otherwise aSpelExpression.- Parameters:
- expression- the expression string.
- Returns:
- the expression.
- Since:
- 5.0
 
 
-