public final class ReflectionUtils
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
ReflectionUtils()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Class<?> |
classFromType(java.lang.reflect.Type t)
Casts the supplied type to a class.
|
static java.lang.Object |
getField(java.lang.reflect.Field field,
java.lang.Object object)
Returns the value of the supplied field on the supplied object.
|
static java.lang.Object |
invokeGetterMethod(java.lang.reflect.Method method,
java.lang.Object object)
Invokes the supplied method on the supplied object.
|
static void |
invokeSetterMethod(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object value)
Invokes the supplied method on the supplied object with the supplied value as a parameter.
|
static void |
setField(java.lang.reflect.Field field,
java.lang.Object object,
java.lang.Object value)
Sets the supplied value of the supplied field on the supplied object.
|
public static java.lang.Class<?> classFromType(java.lang.reflect.Type t)
t - to castjava.lang.IllegalArgumentException - if t is not an instance of Classpublic static java.lang.Object getField(java.lang.reflect.Field field,
java.lang.Object object)
field - containing the value to returnobject - that has the fieldjava.lang.IllegalArgumentException - if the field cannot be retrievedpublic static void setField(java.lang.reflect.Field field,
java.lang.Object object,
java.lang.Object value)
field - of the object to setobject - that has the fieldvalue - to setjava.lang.IllegalArgumentException - if the field cannot be setpublic static java.lang.Object invokeGetterMethod(java.lang.reflect.Method method,
java.lang.Object object)
method - to invokeobject - that has the methodjava.lang.IllegalArgumentException - if the method cannot be invokedpublic static void invokeSetterMethod(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object value)
method - to invokeobject - that has the methodvalue - to setjava.lang.IllegalArgumentException - if the method cannot be invoked