|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.bea.domingo.map.MethodFinder
public final class MethodFinder
Finds methods and constructors that can be invoked by reflection. Attempts to address some of the limitations of the JDK's Class.getMethod() and Class.getConstructor(), and other JDK reflective facilities.
Constructor Summary | |
---|---|
MethodFinder(java.lang.Class clazz)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
java.lang.reflect.Constructor |
findConstructor(java.lang.Class[] parameterTypes)
Returns the most specific public constructor in my target class that accepts the number and type of parameters in the given Class array in a reflective invocation. |
java.lang.reflect.Method |
findMethod(java.lang.String methodName,
java.lang.Class[] parameterTypes)
Returns the most specific public method in my target class that has the given name and accepts the number and type of parameters in the given Class array in a reflective invocation. |
static java.lang.Class[] |
getParameterTypesFrom(java.lang.Object[] args)
|
static java.lang.Class[] |
getParameterTypesFrom(java.lang.String[] classNames)
|
static java.lang.Class[] |
getParameterTypesFrom(java.lang.String[] classNames,
java.lang.ClassLoader loader)
|
int |
hashCode()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MethodFinder(java.lang.Class clazz)
clazz
- Class in which I will look for methods and constructors
throws IllegalArgumentException if clazz is null, or represents a primitive, or represents an array typeMethod Detail |
---|
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public java.lang.reflect.Constructor findConstructor(java.lang.Class[] parameterTypes) throws java.lang.NoSuchMethodException
A null value or Void.TYPE in parameterTypes matches a corresponding Object or array reference in a constructor's formal parameter list, but not a primitive formal parameter.
parameterTypes
- array representing the number and types of
parameters to look for in the constructor's signature. A null
array is treated as a zero-length array.
java.lang.NoSuchMethodException
- if no constructors match the criteria,
or if the reflective call is ambiguous based on the
parameter typespublic java.lang.reflect.Method findMethod(java.lang.String methodName, java.lang.Class[] parameterTypes) throws java.lang.NoSuchMethodException
A null value or Void.TYPE in parameterTypes will match a corresponding Object or array reference in a method's formal parameter list, but not a primitive formal parameter.
methodName
- name of the method to search forparameterTypes
- array representing the number and types of
parameters to look for in the method's signature. A null array
is treated as a zero-length array.
java.lang.NoSuchMethodException
- if no methods match the criteria, or if
the reflective call is ambiguous based on the parameter
types, or if methodName is nullpublic static java.lang.Class[] getParameterTypesFrom(java.lang.Object[] args)
args
- an Object array
public static java.lang.Class[] getParameterTypesFrom(java.lang.String[] classNames) throws java.lang.ClassNotFoundException
classNames
- String array of fully qualified names (FQNs) of classes
or primitives. Represent an array type by using its JVM type
descriptor, with dots instead of slashes (e.g. represent the
type int[] with "[I", and Object[][] with
"[[Ljava.lang.Object;").
java.lang.ClassNotFoundException
- if any of the FQNs name an unknown
classpublic static java.lang.Class[] getParameterTypesFrom(java.lang.String[] classNames, java.lang.ClassLoader loader) throws java.lang.ClassNotFoundException
classNames
- String array of fully qualified names (FQNs) of classes
or primitives. Represent an array type by using its JVM type
descriptor, with dots instead of slashes (e.g. represent the
type int[] with "[I", and Object[][] with
"[[Ljava.lang.Object;").loader
- a ClassLoader
java.lang.ClassNotFoundException
- if any of the FQNs name an unknown
classpublic int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |