|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkoala.dynamicjava.util.ReflectionUtilities
This class contains a collection of utility methods for reflection.
Constructor Summary | |
protected |
ReflectionUtilities()
This class contains only static methods, so it is not useful to create instances of it. |
Method Summary | |
static java.util.List |
getConstructors(java.lang.Class cl,
int params)
Gets all the constructors in the given class or super classes, even the redefined constructors are returned. |
static java.lang.reflect.Field |
getField(java.lang.Class cl,
java.lang.String name)
Returns a field with the given name declared in the given class or in the superclasses of the given class |
static java.util.List |
getMethods(java.lang.Class cl,
java.lang.String name,
int params)
Gets all the methods with the given name in the given class or super classes. |
static java.lang.reflect.Field |
getOuterField(java.lang.Class cl,
java.lang.String name)
Returns a field with the given name declared in one of the outer classes of the given class |
static boolean |
hasCompatibleSignatures(java.lang.Class[] a1,
java.lang.Class[] a2)
For each element (class) of the given arrays, tests if the first array element is assignable from the second array element. |
static boolean |
isCompatible(java.lang.Class c1,
java.lang.Class c2)
Whether 'c1' is assignable from 'c2' |
static java.lang.reflect.Constructor |
lookupConstructor(java.lang.Class cl,
java.lang.Class[] ac)
Looks for a constructor in the given class or in super classes of this class. |
static java.lang.reflect.Method |
lookupMethod(java.lang.Class cl,
java.lang.String name,
java.lang.Class[] ac)
Looks for a method in the given class or in super classes of this class. |
static java.lang.reflect.Method |
lookupMethod(java.lang.Class cl,
java.lang.String name,
java.util.List ac)
Looks for a method in the given class or in super classes of this class. |
static java.lang.reflect.Method |
lookupOuterMethod(java.lang.Class cl,
java.lang.String name,
java.lang.Class[] ac)
Looks up for a method in an outer classes of this class. |
protected static java.lang.reflect.Constructor |
selectTheMostSpecificConstructor(java.lang.reflect.Constructor c1,
java.lang.reflect.Constructor c2)
Returns the constructor with the most specific signature. |
protected static java.lang.reflect.Method |
selectTheMostSpecificMethod(java.lang.reflect.Method m1,
java.lang.reflect.Method m2)
Returns the method with the most specific signature. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ReflectionUtilities()
Method Detail |
public static java.lang.reflect.Constructor lookupConstructor(java.lang.Class cl, java.lang.Class[] ac) throws java.lang.NoSuchMethodException
cl
- the class of which the constructor is a memberac
- the arguments classes (possibly not the exact declaring classes)
java.lang.NoSuchMethodException
public static java.util.List getConstructors(java.lang.Class cl, int params)
cl
- the class where the constructor was declaredparams
- the number of parameters
public static java.lang.reflect.Method lookupMethod(java.lang.Class cl, java.lang.String name, java.util.List ac) throws java.lang.NoSuchMethodException
cl
- the class of which the method is a membername
- the name of the methodac
- the arguments classes (possibly not the exact declaring classes)
java.lang.NoSuchMethodException
public static java.lang.reflect.Method lookupMethod(java.lang.Class cl, java.lang.String name, java.lang.Class[] ac) throws java.lang.NoSuchMethodException
cl
- the class of which the method is a membername
- the name of the methodac
- the arguments classes (possibly not the exact declaring classes)
java.lang.NoSuchMethodException
public static java.util.List getMethods(java.lang.Class cl, java.lang.String name, int params)
cl
- the class where the method was declaredname
- the name of the methodparams
- the number of parameters
public static java.lang.reflect.Method lookupOuterMethod(java.lang.Class cl, java.lang.String name, java.lang.Class[] ac) throws java.lang.NoSuchMethodException
cl
- the inner classname
- the name of the methodac
- the arguments classes (possibly not the exact declaring classes)
java.lang.NoSuchMethodException
public static java.lang.reflect.Field getField(java.lang.Class cl, java.lang.String name) throws java.lang.NoSuchFieldException, AmbiguousFieldException
cl
- the class where the field must look for the fieldname
- the name of the field
java.lang.NoSuchFieldException
AmbiguousFieldException
public static java.lang.reflect.Field getOuterField(java.lang.Class cl, java.lang.String name) throws java.lang.NoSuchFieldException, AmbiguousFieldException
cl
- the inner classname
- the name of the field
java.lang.NoSuchFieldException
AmbiguousFieldException
protected static java.lang.reflect.Method selectTheMostSpecificMethod(java.lang.reflect.Method m1, java.lang.reflect.Method m2)
protected static java.lang.reflect.Constructor selectTheMostSpecificConstructor(java.lang.reflect.Constructor c1, java.lang.reflect.Constructor c2)
public static boolean hasCompatibleSignatures(java.lang.Class[] a1, java.lang.Class[] a2)
public static boolean isCompatible(java.lang.Class c1, java.lang.Class c2)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |