Search in sources :

Example 1 with SimpleEvaluationContext

use of org.springframework.expression.spel.support.SimpleEvaluationContext in project spring-integration by spring-projects.

the class IntegrationSimpleEvaluationContextFactoryBean method getObject.

@Override
public SimpleEvaluationContext getObject() throws Exception {
    Collection<PropertyAccessor> accessors = getPropertyAccessors().values();
    PropertyAccessor[] accessorArray = accessors.toArray(new PropertyAccessor[accessors.size() + 2]);
    accessorArray[accessors.size()] = new MapAccessor();
    accessorArray[accessors.size() + 1] = DataBindingPropertyAccessor.forReadOnlyAccess();
    SimpleEvaluationContext evaluationContext = SimpleEvaluationContext.forPropertyAccessors(accessorArray).withTypeConverter(getTypeConverter()).withInstanceMethods().build();
    for (Entry<String, Method> functionEntry : getFunctions().entrySet()) {
        evaluationContext.setVariable(functionEntry.getKey(), functionEntry.getValue());
    }
    return evaluationContext;
}
Also used : DataBindingPropertyAccessor(org.springframework.expression.spel.support.DataBindingPropertyAccessor) PropertyAccessor(org.springframework.expression.PropertyAccessor) SimpleEvaluationContext(org.springframework.expression.spel.support.SimpleEvaluationContext) MapAccessor(org.springframework.context.expression.MapAccessor) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 MapAccessor (org.springframework.context.expression.MapAccessor)1 PropertyAccessor (org.springframework.expression.PropertyAccessor)1 DataBindingPropertyAccessor (org.springframework.expression.spel.support.DataBindingPropertyAccessor)1 SimpleEvaluationContext (org.springframework.expression.spel.support.SimpleEvaluationContext)1