public class ReflectionUtil extends java.lang.Object
Constructor and Description |
---|
ReflectionUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Field |
getField(java.lang.Class<?> objectClass,
java.lang.String fieldName,
boolean forceAccess)
Return the Field object corresponding to the specified field name.
|
static java.lang.reflect.Field |
getField(java.lang.Object object,
java.lang.String fieldName,
boolean forceAccess)
Deprecated.
Use
getField(Class, String, boolean) instead. |
static java.lang.Object |
getFieldObject(java.lang.Object object,
java.lang.String fieldName,
boolean forceAccess)
Return the object instance corresponding to the specified field name.
|
static java.lang.reflect.Method |
getMethod(java.lang.Class<?> objectClass,
java.lang.String methodName,
boolean forceAccess,
java.lang.Class<?>... parameterTypes)
Return the Method object corresponding to the specified method name and parameters.
|
static java.lang.reflect.Method |
getMethod(java.lang.Object object,
java.lang.String methodName,
boolean forceAccess,
java.lang.Class<?>... parameterTypes)
Deprecated.
Use
getMethod(Class, String, boolean, Class...) instead. |
static java.lang.Object |
invokeMethod(java.lang.Object object,
java.lang.String methodName,
boolean forceAccess,
java.lang.Object... args)
Invoke the method of
object corresponding to the specified name and with
specified parameters values. |
public ReflectionUtil()
public static java.lang.reflect.Method getMethod(java.lang.Class<?> objectClass, java.lang.String methodName, boolean forceAccess, java.lang.Class<?>... parameterTypes) throws java.lang.SecurityException, java.lang.NoSuchMethodException
java.lang.SecurityException
java.lang.NoSuchMethodException
@Deprecated public static java.lang.reflect.Method getMethod(java.lang.Object object, java.lang.String methodName, boolean forceAccess, java.lang.Class<?>... parameterTypes) throws java.lang.SecurityException, java.lang.NoSuchMethodException
getMethod(Class, String, boolean, Class...)
instead.java.lang.SecurityException
java.lang.NoSuchMethodException
public static java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, boolean forceAccess, java.lang.Object... args) throws java.lang.SecurityException, java.lang.NoSuchMethodException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
object
corresponding to the specified name and with
specified parameters values.java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public static java.lang.reflect.Field getField(java.lang.Class<?> objectClass, java.lang.String fieldName, boolean forceAccess) throws java.lang.SecurityException, java.lang.NoSuchFieldException
java.lang.SecurityException
java.lang.NoSuchFieldException
@Deprecated public static java.lang.reflect.Field getField(java.lang.Object object, java.lang.String fieldName, boolean forceAccess) throws java.lang.SecurityException, java.lang.NoSuchFieldException
getField(Class, String, boolean)
instead.java.lang.SecurityException
java.lang.NoSuchFieldException
public static java.lang.Object getFieldObject(java.lang.Object object, java.lang.String fieldName, boolean forceAccess) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.SecurityException, java.lang.NoSuchFieldException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.SecurityException
java.lang.NoSuchFieldException