Example usage for org.springframework.expression MethodResolver resolve

List of usage examples for org.springframework.expression MethodResolver resolve

Introduction

In this page you can find the example usage for org.springframework.expression MethodResolver resolve.

Prototype

@Nullable
MethodExecutor resolve(EvaluationContext context, Object targetObject, String name,
        List<TypeDescriptor> argumentTypes) throws AccessException;

Source Link

Document

Within the supplied context determine a suitable method on the supplied object that can handle the specified arguments.

Usage

From source file:net.abhinavsarkar.spelhelper.ImplicitPropertyAccessor.java

@Override
public boolean canRead(final EvaluationContext context, final Object target, final String name)
        throws AccessException {
    Assert.notNull(target, "target is null");
    String cacheKey = target.getClass().getName() + "." + name;
    if (CACHE.containsKey(cacheKey)) {
        return CACHE.get(cacheKey) != NULL_ME;
    }/*w  ww  . j  a  v  a 2 s  .co  m*/

    for (MethodResolver mr : context.getMethodResolvers()) {
        MethodExecutor me = mr.resolve(context, target, name, Collections.<TypeDescriptor>emptyList());
        if (me != null) {
            CACHE.putIfAbsent(cacheKey, me);
            return true;
        }
    }

    CACHE.putIfAbsent(cacheKey, NULL_ME);
    return false;
}