List of usage examples for org.springframework.expression.spel.support StandardEvaluationContext getPropertyAccessors
@Override
public List<PropertyAccessor> getPropertyAccessors()
From source file:net.abhinavsarkar.spelhelper.SpelHelper.java
private EvaluationContext getEvaluationContext(final Object rootObject) { StandardEvaluationContext newContext = new StandardEvaluationContext(rootObject); newContext.getMethodResolvers().add(new ImplicitMethodResolver()); newContext.getPropertyAccessors().add(new ImplicitPropertyAccessor()); newContext.setConstructorResolvers(asList((ConstructorResolver) new ImplicitConstructorResolver())); for (Method method : registeredFunctions) { newContext.setVariable(method.getName(), method); }//w ww . j a v a 2s.c om newContext.setVariable(CONTEXT_LOOKUP_KEY, this); return newContext; }
From source file:org.echocat.redprecursor.annotations.ParametersPassesExpressionUnitTest.java
@Test public void testToContext() throws Exception { final MethodCall<ParametersPassesExpressionUnitTest> methodCall = toMethodCall( ParametersPassesExpressionUnitTest.class, this, "test", "a", 1, "b", 2); final StandardEvaluationContext context = new Evaluator().toContext(methodCall); assertThat(context.getRootObject().getValue(), is((Object) methodCall)); assertThat(context.lookupVariable("methodName"), is((Object) "test")); assertThat(context.lookupVariable("parameters"), is((Object) methodCall.getParameters())); assertThat(context.getPropertyAccessors(), is(Evaluator.DEFAULT_PROPERTY_ACCESSORS)); }