Package org.apache.commons.jxpath.util
Class MethodLookupUtils
- java.lang.Object
-
- org.apache.commons.jxpath.util.MethodLookupUtils
-
public class MethodLookupUtils extends java.lang.ObjectMethod lookup utilities, which find static and non-static methods as well as constructors based on a name and list of parameters.- Version:
- $Revision: 670727 $ $Date: 2008-06-23 15:10:38 -0500 (Mon, 23 Jun 2008) $
-
-
Field Summary
Fields Modifier and Type Field Description private static intAPPROXIMATE_MATCHprivate static intEXACT_MATCHprivate static intNO_MATCH
-
Constructor Summary
Constructors Constructor Description MethodLookupUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.reflect.ConstructorlookupConstructor(java.lang.Class targetClass, java.lang.Object[] parameters)Look up a constructor.static java.lang.reflect.MethodlookupMethod(java.lang.Class targetClass, java.lang.String name, java.lang.Object[] parameters)Look up a method.static java.lang.reflect.MethodlookupStaticMethod(java.lang.Class targetClass, java.lang.String name, java.lang.Object[] parameters)Look up a static method.private static intmatchParameterTypes(java.lang.Class[] types, java.lang.Object[] parameters)Return a match code of objects to types.private static intmatchType(java.lang.Class expected, java.lang.Object object)Return a match code between an object and type.
-
-
-
Field Detail
-
NO_MATCH
private static final int NO_MATCH
- See Also:
- Constant Field Values
-
APPROXIMATE_MATCH
private static final int APPROXIMATE_MATCH
- See Also:
- Constant Field Values
-
EXACT_MATCH
private static final int EXACT_MATCH
- See Also:
- Constant Field Values
-
-
Method Detail
-
lookupConstructor
public static java.lang.reflect.Constructor lookupConstructor(java.lang.Class targetClass, java.lang.Object[] parameters)Look up a constructor.- Parameters:
targetClass- the class constructedparameters- arguments- Returns:
- Constructor found if any.
-
lookupStaticMethod
public static java.lang.reflect.Method lookupStaticMethod(java.lang.Class targetClass, java.lang.String name, java.lang.Object[] parameters)Look up a static method.- Parameters:
targetClass- the owning classname- method nameparameters- method parameters- Returns:
- Method found if any
-
lookupMethod
public static java.lang.reflect.Method lookupMethod(java.lang.Class targetClass, java.lang.String name, java.lang.Object[] parameters)Look up a method.- Parameters:
targetClass- owning classname- method nameparameters- method parameters- Returns:
- Method found if any
-
matchParameterTypes
private static int matchParameterTypes(java.lang.Class[] types, java.lang.Object[] parameters)Return a match code of objects to types.- Parameters:
types- Class[] of expected typesparameters- Object[] to attempt to match- Returns:
- int code
-
matchType
private static int matchType(java.lang.Class expected, java.lang.Object object)Return a match code between an object and type.- Parameters:
expected- class to testobject- object to test- Returns:
- int code
-
-