org.apache.commons.jexl.util.introspection
public class MethodMap extends Object
Since: 1.0
Version: $Id: MethodMap.java 398495 2006-05-01 01:33:43Z dion $
Nested Class Summary | |
---|---|
static class | MethodMap.AmbiguousException
simple distinguishable exception, used when we run across ambiguous
overloading. |
Field Summary | |
---|---|
protected Map | methodByNameMap
Keep track of all methods with the same name. |
Method Summary | |
---|---|
void | add(Method method)
Add a method to a list of methods by name. |
Method | find(String methodName, Object[] args) Find a method. |
List | get(String key)
Return a list of methods with the same name.
|
Parameters: method the method.
Find a method. Attempts to find the most specific applicable method using the algorithm described in the JLS section 15.12.2 (with the exception that it can't distinguish a primitive type argument from an object type argument, since in reflection primitive type arguments are represented by their object counterparts, so for an argument of type (say) java.lang.Integer, it will not be able to decide between a method that takes int and a method that takes java.lang.Integer as a parameter.
This turns out to be a relatively rare case where this is needed - however, functionality like this is needed.
Parameters: methodName name of method args the actual arguments with which the method is called
Returns: the most specific applicable method, or null if no method is applicable.
Throws: AmbiguousException if there is more than one maximally specific applicable method
Parameters: key The method name.
Returns: List list of methods