public class ReflectionUtils extends Object
Constructor and Description |
---|
ReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
getFieldVal(Object obj,
String fieldName,
boolean throwException)
Get the value of the named field in the class of the given object or any of its superclasses.
|
static Object |
getStaticFieldVal(Class<?> cls,
String fieldName,
boolean throwException)
Get the value of the named static field in the given class or any of its superclasses.
|
static Object |
invokeMethod(Object obj,
String methodName,
boolean throwException)
Invoke the named method in the given object or its superclasses.
|
static Object |
invokeMethod(Object obj,
String methodName,
Class<?> argType,
Object arg,
boolean throwException)
Invoke the named method in the given object or its superclasses.
|
static Object |
invokeStaticMethod(Class<?> cls,
String methodName,
boolean throwException)
Invoke the named static method.
|
static Object |
invokeStaticMethod(Class<?> cls,
String methodName,
Class<?> argType,
Object arg,
boolean throwException)
Invoke the named static method.
|
public static Object getFieldVal(Object obj, String fieldName, boolean throwException)
public static Object getStaticFieldVal(Class<?> cls, String fieldName, boolean throwException)
public static Object invokeMethod(Object obj, String methodName, boolean throwException)
public static Object invokeMethod(Object obj, String methodName, Class<?> argType, Object arg, boolean throwException)
public static Object invokeStaticMethod(Class<?> cls, String methodName, boolean throwException) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
public static Object invokeStaticMethod(Class<?> cls, String methodName, Class<?> argType, Object arg, boolean throwException)
Copyright © 2018. All rights reserved.