Top Description Fields Constructors Methods
org.apache.commons.jexl2.internal.introspection

pack-priv final Class MethodMap

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, java.util.ArrayList, .HashMap, .List, .Map

A map of method names to methods.
Since
1.0

Field Summary

Modifier and TypeField and Description
private final Map<String, List<Method>>
methodByNameMap

Keep track of all methods with the same name.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized void
add(Method
the method.
method
)

Add a method to a list of methods by name.

public Method

Returns:

the most specific applicable method, or null if no method is applicable.
find
(String
name of method
methodName
,
Object[]
the actual arguments with which the method is called
args
)

Find a method.

pack-priv Method

Returns:

the method
find
(MethodKey
the key
methodKey
)

Finds a method by key.

public synchronized List<Method>

Returns:

List list of methods.
get
(String
the name.
key
)

Return a list of methods with the same name.

public synchronized String[]

Returns:

the array of names
names
()

Returns the array of method names accessible in this class.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodByNameMapback to summary
private final Map<String, List<Method>> methodByNameMap

Keep track of all methods with the same name.

Constructor Detail

MethodMapback to summary
pack-priv MethodMap()

Method Detail

addback to summary
public synchronized void add(Method method)

Add a method to a list of methods by name. For a particular class we are keeping track of all the methods with the same name.

Parameters
method:Method

the method.

findback to summary
public Method find(String methodName, Object[] args) throws AmbiguousException

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:String

name of method

args:Object[]

the actual arguments with which the method is called

Returns:Method

the most specific applicable method, or null if no method is applicable.

Exceptions
AmbiguousException:
if there is more than one maximally specific applicable method
findback to summary
pack-priv Method find(MethodKey methodKey) throws AmbiguousException

Finds a method by key.

Parameters
methodKey:MethodKey

the key

Returns:Method

the method

Exceptions
AmbiguousException:
if find is ambiguous
getback to summary
public synchronized List<Method> get(String key)

Return a list of methods with the same name.

Parameters
key:String

the name.

Returns:List<Method>

List list of methods.

namesback to summary
public synchronized String[] names()

Returns the array of method names accessible in this class.

Returns:String[]

the array of names