|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.bechte.junit.runners.util.ReflectionUtil
public final class ReflectionUtil
Set of helper methods to retrieve information using Java's reflection API.
| Method Summary | |
|---|---|
static Object |
createDeepInstance(Stack<Class<?>> classHierarchy)
Returns an instance of the Class, represented by the given class hierarchy. |
static Stack<Class<?>> |
getClassHierarchy(Class<?> clazz)
Returns a Stack of classes, representing the hierarchy of the given Class. |
static Object |
getEnclosingInstance(Object target)
Returns the Object that encloses the given target. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Object getEnclosingInstance(Object target)
throws IllegalAccessException
Object that encloses the given target. This method returns null if the given
target is null or its Class is not a member class.
target - theĀ Object to retrieve the enclosing instance for
Object of target
IllegalArgumentException - If target is null.
IllegalAccessException - An instance of the enclosing class is kept in a private field within the enclosed
instance. Accessing the field might throw an IllegalAccessException.
IllegalStateException - If no field containing the enclosing instance can be found.public static Stack<Class<?>> getClassHierarchy(Class<?> clazz)
Stack of classes, representing the hierarchy of the given Class.
clazz - the Class to retrieve the hierarchy for
Class hierarchy
public static Object createDeepInstance(Stack<Class<?>> classHierarchy)
throws Throwable
Class, represented by the given class hierarchy.
classHierarchy - the hierarchy representing a deep class
Throwable - if errors occurred during construction of the instance
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||