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