public class ReflectionUtil extends Object
| Constructor and Description |
|---|
ReflectionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Method |
findDeclaredMethod(Class<?> klass,
String methodName,
Object... args)
Find the single declared method in the class hierarchy that matches the name and parameters.
|
static Constructor<?> |
getDeclaredConstructor(Class<?> klass,
Class<?>... paramTypes) |
static Object |
getFieldValue(Class<?> orig,
String field) |
static Object |
getFieldValue(Object o,
String field) |
static Object |
invoke(Object target,
String methodName)
Invoke a declared method with no parameters
|
static Object |
invoke(Object target,
String methodName,
Object param1)
Invoke a declared method with one parameter.
|
static Object |
invoke(Object target,
String methodName,
Object param1,
Object param2)
Invoke a declared method with two parameters.
|
static Object |
invoke(Object target,
String methodName,
Object param1,
Object param2,
Object param3)
Invoke a declared method with three parameters.
|
static Object |
invokeByArgs(Object target,
String methodName,
Object... args) |
static void |
setAccessible(AccessibleObject m) |
static void |
setFieldValue(Object o,
String field,
Object value) |
public static Object invoke(Object target, String methodName, Object param1, Object param2, Object param3)
public static Object invoke(Object target, String methodName, Object param1, Object param2)
public static Object invoke(Object target, String methodName, Object param1)
public static Object invoke(Object target, String methodName)
public static Method findDeclaredMethod(Class<?> klass, String methodName, Object... args) throws NoSuchMethodException
NoSuchMethodExceptionpublic static void setAccessible(AccessibleObject m)
public static Constructor<?> getDeclaredConstructor(Class<?> klass, Class<?>... paramTypes)
Copyright © 2016. All rights reserved.