|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ebmwebsourcing.easycommons.lang.reflect.ReflectionHelper
public final class ReflectionHelper
| Method Summary | ||
|---|---|---|
static Set<Class<?>> |
findAllImplementedInterfaces(Class<?> clazz)
Find all implemented interfaces recursively. |
|
static Collection<Method> |
findMethodsThatReturnType(Class<?> clazz,
Class<?> returnType)
|
|
static Method |
getDeclaredMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
Get a declared method and wrap exceptions into unchecked exceptions. |
|
static Object |
getFieldValue(Object obj,
Field field)
|
|
static Object |
getPrivateFieldValue(Class<?> clazz,
Object instance,
String fieldName)
|
|
static List<Method> |
getPublicDeclaredMethods(Class<?> clazz)
Get all public declared methods and wrap exceptions into unchecked exceptions. |
|
static Method |
getPublicMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
Get a public method and wrap exceptions into unchecked exceptions. |
|
static Object |
invokeMethod(Object obj,
Method method,
Object... args)
Invoke a method by reflection. |
|
static Object |
invokePrivateMethod(Object obj,
String methodName,
Object... args)
Invoke a private method by reflection. |
|
static boolean |
isOrInheritedFrom(Class<?> clazz,
String canonicalName)
Test if the specified class is or inherited from the class with the specified canonical name |
|
static
|
loadClass(String className,
ClassLoader cl)
|
|
static
|
newInstance(Class<T> clazz,
Object... args)
|
|
static
|
newInstance(String className,
ClassLoader cl,
Object... args)
|
|
static void |
setFieldValue(Object obj,
Field field,
Object newValue)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final Set<Class<?>> findAllImplementedInterfaces(Class<?> clazz)
clazz - Class for which we want to know all implemented interfaces.
public static final Method getPublicMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
clazz - methodName - parameterTypes -
public static final List<Method> getPublicDeclaredMethods(Class<?> clazz)
clazz -
public static final Method getDeclaredMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
clazz - methodName - parameterTypes -
public static final Object invokeMethod(Object obj,
Method method,
Object... args)
throws InvocationTargetException
obj - Object on which to invoke method.method - Method to be invoked.args - Method arguments.
InvocationTargetException
public static final Object invokePrivateMethod(Object obj,
String methodName,
Object... args)
throws InvocationTargetException
obj - Object on which to invoke method.method - Method to be invoked.args - Method arguments.
InvocationTargetException
public static final <T> T newInstance(Class<T> clazz,
Object... args)
throws InvocationTargetException
InvocationTargetException
public static final <T> T newInstance(String className,
ClassLoader cl,
Object... args)
throws InvocationTargetException
InvocationTargetException
public static final <T> Class<T> loadClass(String className,
ClassLoader cl)
public static final Collection<Method> findMethodsThatReturnType(Class<?> clazz,
Class<?> returnType)
public static final Object getPrivateFieldValue(Class<?> clazz,
Object instance,
String fieldName)
public static final Object getFieldValue(Object obj,
Field field)
public static final void setFieldValue(Object obj,
Field field,
Object newValue)
public static final boolean isOrInheritedFrom(Class<?> clazz,
String canonicalName)
clazz - the class to checksuperClassName - the class name to look for
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||