|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.reflect.plugins.introspection.ReflectionUtils
public class ReflectionUtils
ReflectionUtils.
| Constructor Summary | |
|---|---|
ReflectionUtils()
|
|
| Method Summary | |
|---|---|
protected static Object |
arrayInfo(Object... objects)
Get array info. |
static Constructor<?> |
findConstructor(Class<?> clazz,
Class<?>... parameterTypes)
Find the constructor by parameters. |
static Constructor<?> |
findExactConstructor(Class<?> clazz,
Class<?>... parameterTypes)
Find the constructor by parameters. |
static Field |
findExactField(Class<?> clazz,
String name)
Find the field by name. |
static Method |
findExactMethod(Class<?> clazz,
String name,
Class<?>... parameterTypes)
Find the method by name and parameters. |
static Field |
findField(Class<?> clazz,
String name)
Find the field by name. |
static Method |
findMethod(Class<?> clazz,
String name,
Class<?>... parameterTypes)
Find the method by name and parameters. |
static Object |
getField(Field field,
Object target)
Get a field |
static Throwable |
handleErrors(String context,
Field field,
Object target,
Object value,
Throwable t)
Handle errors |
static Throwable |
handleErrors(String context,
Object target,
Class<?>[] parameters,
Object[] arguments,
Throwable t)
Handle errors |
static Object |
invoke(Method method,
Object target,
Object[] arguments)
Invoke on a method |
static Object |
newInstance(Class<?> clazz)
Create a new instance |
static Object |
newInstance(Constructor<?> constructor,
Object[] arguments)
Create a new instance |
static Object |
newInstance(String className)
Create a new instance |
static Object |
newInstance(String className,
ClassLoader cl)
Create a new instance |
static Object |
setField(Field field,
Object target,
Object value)
Set a field |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtils()
| Method Detail |
|---|
public static Object invoke(Method method,
Object target,
Object[] arguments)
throws Throwable
method - the methodtarget - the targetarguments - the arguments
Throwable - for any error
public static Object newInstance(Class<?> clazz)
throws Throwable
clazz - the class
Throwable - for any error
public static Object newInstance(String className,
ClassLoader cl)
throws Throwable
className - the class namecl - the classloader
Throwable - for any error
public static Object newInstance(String className)
throws Throwable
className - the class name
Throwable - for any error
public static Object newInstance(Constructor<?> constructor,
Object[] arguments)
throws Throwable
constructor - the constructorarguments - the arguments
Throwable - for any error
public static Object getField(Field field,
Object target)
throws Throwable
field - the fieldtarget - the target
Throwable - for any error
public static Object setField(Field field,
Object target,
Object value)
throws Throwable
field - the fieldtarget - the targetvalue - the value
Throwable - for any errorprotected static Object arrayInfo(Object... objects)
objects - the array of objects
public static Method findMethod(Class<?> clazz,
String name,
Class<?>... parameterTypes)
clazz - the class to look for methodname - the nameparameterTypes - the types
public static Method findExactMethod(Class<?> clazz,
String name,
Class<?>... parameterTypes)
throws NoSuchMethodException
clazz - the class to look for methodname - the nameparameterTypes - the types
NoSuchMethodException - for no such method
public static Field findField(Class<?> clazz,
String name)
clazz - the class to look for fieldname - the name
public static Field findExactField(Class<?> clazz,
String name)
throws NoSuchFieldException
clazz - the class to look for fieldname - the name
NoSuchFieldException - for no such field
public static Constructor<?> findConstructor(Class<?> clazz,
Class<?>... parameterTypes)
clazz - the class to look for constructorparameterTypes - the types
public static Constructor<?> findExactConstructor(Class<?> clazz,
Class<?>... parameterTypes)
throws NoSuchMethodException
clazz - the class to look for constructorparameterTypes - the types
NoSuchMethodException - for no such method
public static Throwable handleErrors(String context,
Object target,
Class<?>[] parameters,
Object[] arguments,
Throwable t)
throws Throwable
context - the contexttarget - the targetparameters - the parametersarguments - the argumentst - the error
Throwable - always
public static Throwable handleErrors(String context,
Field field,
Object target,
Object value,
Throwable t)
throws Throwable
context - the contextfield - the fieldtarget - the targetvalue - the valuet - the error
Throwable - always
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||