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.
|
static String |
modifiersToString(int modifiers,
boolean isMethod)
Convert field or method modifiers into a string representation, e.g.
|
static List<String> |
parseTypeDescriptor(String typeDescriptor)
Parse a type descriptor into a type or list of types.
|
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
public static String modifiersToString(int modifiers, boolean isMethod)
public static List<String> parseTypeDescriptor(String typeDescriptor)
Copyright © 2017. All rights reserved.