org.springframework.expression.spel.support
Class ReflectiveMethodResolver

java.lang.Object
  extended by org.springframework.expression.spel.support.ReflectiveMethodResolver
All Implemented Interfaces:
MethodResolver

public class ReflectiveMethodResolver
extends java.lang.Object
implements MethodResolver

A method resolver that uses reflection to locate the method that should be invoked.

Since:
3.0
Author:
Andy Clement, Juergen Hoeller

Field Summary
private  java.util.Map<java.lang.Class<?>,MethodFilter> filters
           
private static java.lang.reflect.Method[] NO_METHODS
           
 
Constructor Summary
ReflectiveMethodResolver()
           
 
Method Summary
 void registerMethodFilter(java.lang.Class<?> type, MethodFilter filter)
           
 MethodExecutor resolve(EvaluationContext context, java.lang.Object targetObject, java.lang.String name, java.util.List<TypeDescriptor> argumentTypes)
          Locate a method on a type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_METHODS

private static java.lang.reflect.Method[] NO_METHODS

filters

private java.util.Map<java.lang.Class<?>,MethodFilter> filters
Constructor Detail

ReflectiveMethodResolver

public ReflectiveMethodResolver()
Method Detail

resolve

public MethodExecutor resolve(EvaluationContext context,
                              java.lang.Object targetObject,
                              java.lang.String name,
                              java.util.List<TypeDescriptor> argumentTypes)
                       throws AccessException
Locate a method on a type. There are three kinds of match that might occur:
  1. An exact match where the types of the arguments match the types of the constructor
  2. An in-exact match where the types we are looking for are subtypes of those defined on the constructor
  3. A match where we are able to convert the arguments into those expected by the constructor, according to the registered type converter.

Specified by:
resolve in interface MethodResolver
Parameters:
context - the current evaluation context
targetObject - the object upon which the method is being called
argumentTypes - the arguments that the constructor must be able to handle
Returns:
a MethodExecutor that can invoke the method, or null if the method cannot be found
Throws:
AccessException

registerMethodFilter

public void registerMethodFilter(java.lang.Class<?> type,
                                 MethodFilter filter)