use of org.springframework.expression.spel.support.SimpleEvaluationContext.Builder in project spring-integration by spring-projects.
the class ExpressionUtils method createEvaluationContext.
/**
* Create a {@link StandardEvaluationContext} with a {@link MapAccessor} in its
* property accessor property and the supplied {@link ConversionService} in its
* conversionService property.
* @param conversionService the conversion service.
* @param beanFactory the bean factory.
* @param simple true if simple.
* @return the evaluation context.
*/
private static EvaluationContext createEvaluationContext(ConversionService conversionService, BeanFactory beanFactory, boolean simple) {
if (simple) {
Builder ecBuilder = SimpleEvaluationContext.forPropertyAccessors(new MapAccessor(), DataBindingPropertyAccessor.forReadOnlyAccess()).withInstanceMethods();
if (conversionService != null) {
ecBuilder.withConversionService(conversionService);
}
return ecBuilder.build();
} else {
StandardEvaluationContext evaluationContext = new StandardEvaluationContext();
evaluationContext.addPropertyAccessor(new MapAccessor());
if (conversionService != null) {
evaluationContext.setTypeConverter(new StandardTypeConverter(conversionService));
}
if (beanFactory != null) {
evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
}
return evaluationContext;
}
}
Aggregations