|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ijsberg.iglu.util.reflection.ReflectionSupport
public class ReflectionSupport
Helper class containing methods to be used to investigate method declarations, invoke methods, instantiate or clone objects.
| Constructor Summary | |
|---|---|
ReflectionSupport()
|
|
| Method Summary | |
|---|---|
static ArrayList<Class<?>> |
getAllSuperClassesFromClass(Class<?> clasz)
|
static ArrayList<Class<?>> |
getInterfacesForClass(Class<?> clasz)
|
static Set<Method> |
getMethodsByName(Class<?> clasz,
String methodName,
int requiredNrofParameters)
|
static Object |
instantiateClass(Class<?> clasz,
Object... initArgs)
Instantiates a class by invoking a constructor with the given init parameters. |
static Object |
instantiateClass(ClassLoader classloader,
String className,
Object... initArgs)
Instantiates a class by invoking a constructor with certain init parameters. |
static Object |
instantiateClass(String className)
Instantiates a class by its default constructor. |
static Object |
instantiateClass(String className,
Object... initArgs)
Instantiates a class by invoking a constructor with the given init parameters. |
static Object |
invokeMethod(Object impl,
String methodName,
Object... arguments)
Arguments do not have to match exactly; they will be converted if possible. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionSupport()
| Method Detail |
|---|
public static ArrayList<Class<?>> getAllSuperClassesFromClass(Class<?> clasz)
clasz -
public static ArrayList<Class<?>> getInterfacesForClass(Class<?> clasz)
clasz -
public static Object invokeMethod(Object impl,
String methodName,
Object... arguments)
throws NoSuchMethodException,
InvocationTargetException
impl - the object on which the method is invokedmethodName - name of method to be invokedarguments - zero or more arguments
InvocationTargetException - if the invoked method throws
NoSuchMethodException - if no suitable method is found
public static Object instantiateClass(String className)
throws InstantiationException
className -
IllegalAccessException
InstantiationException
public static Object instantiateClass(String className,
Object... initArgs)
throws InstantiationException
className - initArgs -
ClassNotFoundException
IllegalAccessException
InstantiationException
public static Object instantiateClass(ClassLoader classloader,
String className,
Object... initArgs)
throws InstantiationException
classloader - className - initArgs -
ClassNotFoundException
IllegalAccessException
InstantiationException
public static Object instantiateClass(Class<?> clasz,
Object... initArgs)
throws InstantiationException
clasz - initArgs -
InstantiationException
public static Set<Method> getMethodsByName(Class<?> clasz,
String methodName,
int requiredNrofParameters)
clasz - methodName - requiredNrofParameters -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||