use of de.odysseus.el.util.SimpleContext in project camel by apache.
the class JuelExpression method createContext.
/**
* Factory method to create the EL context
*/
protected ELContext createContext() {
ELResolver resolver = new CompositeELResolver() {
{
add(new ArrayELResolver(false));
add(new ListELResolver(false));
add(new MapELResolver(false));
add(new ResourceBundleELResolver());
add(new BeanAndMethodELResolver());
}
};
return new SimpleContext(resolver);
}
use of de.odysseus.el.util.SimpleContext in project camel by apache.
the class JuelExpression method setVariable.
protected void setVariable(ELContext context, String name, Object value, Class<?> type) {
ValueExpression valueExpression = getExpressionFactory().createValueExpression(value, type);
SimpleContext simpleContext = (SimpleContext) context;
simpleContext.setVariable(name, valueExpression);
}
use of de.odysseus.el.util.SimpleContext in project camel by apache.
the class JuelTest method testJuel.
@Test
public void testJuel() throws Exception {
ExpressionFactory factory = new ExpressionFactoryImpl();
ELContext context = new SimpleContext();
ValueExpression valueExpression = factory.createValueExpression(context, "${123 * 2}", Object.class);
Object value = valueExpression.getValue(context);
assertEquals("Result is a Long object", 246L, value);
}
Aggregations