public class ReflectiveMethodResolver extends Object implements MethodResolver
MethodResolver
used by default in StandardEvaluationContext
unless explicit method resolvers have been specified.StandardEvaluationContext.addMethodResolver(MethodResolver)
Constructor and Description |
---|
ReflectiveMethodResolver() |
ReflectiveMethodResolver(boolean useDistance)
This constructor allows the ReflectiveMethodResolver to be configured such that it
will use a distance computation to check which is the better of two close matches
(when there are multiple matches).
|
Modifier and Type | Method and Description |
---|---|
protected Method[] |
getMethods(Class<?> type)
Return the set of methods for this type.
|
void |
registerMethodFilter(Class<?> type,
MethodFilter filter) |
MethodExecutor |
resolve(EvaluationContext context,
Object targetObject,
String name,
List<TypeDescriptor> argumentTypes)
Locate a method on a type.
|
public ReflectiveMethodResolver()
public ReflectiveMethodResolver(boolean useDistance)
useDistance
- true
if distance computation should be used when
calculating matches; false
otherwisepublic void registerMethodFilter(Class<?> type, MethodFilter filter)
public MethodExecutor resolve(EvaluationContext context, Object targetObject, String name, List<TypeDescriptor> argumentTypes) throws AccessException
resolve
in interface MethodResolver
context
- the current evaluation contexttargetObject
- the object upon which the method is being calledargumentTypes
- the arguments that the constructor must be able to handleAccessException
protected Method[] getMethods(Class<?> type)
Class.getMethods()
for the given type
, but subclasses
may override in order to alter the results, e.g. specifying static methods
declared elsewhere.type
- the class for which to return the methods