List of usage examples for org.springframework.expression.spel.support StandardEvaluationContext getMethodResolvers
@Override
public List<MethodResolver> getMethodResolvers()
From source file:guru.qas.martini.DefaultMixologist.java
protected Collection<Martini> getMartinis(Expression expression) { StandardEvaluationContext context = new StandardEvaluationContext(); List<MethodResolver> methodResolvers = context.getMethodResolvers(); ArrayList<MethodResolver> modifiedList = Lists.newArrayList(methodResolvers); modifiedList.add(new TagResolver(this.context, categories)); context.setMethodResolvers(modifiedList); ImmutableList<Martini> martinis = getMartinis(); List<Martini> matches = Lists.newArrayListWithCapacity(martinis.size()); for (Martini martini : martinis) { Boolean match = expression.getValue(context, martini, Boolean.class); if (null != match && match) { matches.add(martini);/*from w ww . j ava2s . co m*/ } } return matches; }
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); }//from ww w . j a v a2 s . c om newContext.setVariable(CONTEXT_LOOKUP_KEY, this); return newContext; }