public final class ReflectionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Constructor |
getConstructor(Class<?> clazz,
Class<?>... arguments) |
static Method |
getMethod(Class<?> clazz,
String methodName,
Class<?>... parameters) |
static Method |
getMethod(Object instance,
String methodName,
Class<?>... parameters) |
static <T> T |
instantiate(ClassLoader classLoader,
String classname,
Class<T> returnType) |
static Object |
instantiateObject(String className,
Class[] types,
Object[] params,
ClassLoader classLoader) |
static Object |
instantiateOneArg(ClassLoader classLoader,
String className,
Class<?> param1Class,
Object param1) |
static Object |
instantiateTwoArgs(ClassLoader classLoader,
String className,
Class<?> param1Class,
Object param1,
Class param2Class,
Object param2) |
static Object |
invokeGetter(Object instance,
String methodName) |
static Object |
invokeMethodWithArray(Object target,
Method method,
Object... args) |
static Object |
invokeMethodWithArray2(Object target,
Method method,
Object... args) |
static Object |
invokeSetter(Object target,
Method method,
Object value) |
static void |
invokeSetter(Object o,
String name,
Class<?> value1clazz,
Object value) |
static Class<?> |
loadClass(ClassLoader classLoader,
String className) |
static Object |
newInstance(Constructor constructor,
Object... params) |
static Method |
tryGetMethod(Class<?> clazz,
String methodName,
Class<?>... parameters) |
static Class<?> |
tryLoadClass(ClassLoader classLoader,
String className) |
public static Method getMethod(Object instance, String methodName, Class<?>... parameters)
public static Method tryGetMethod(Class<?> clazz, String methodName, Class<?>... parameters)
public static Constructor getConstructor(Class<?> clazz, Class<?>... arguments)
public static Object newInstance(Constructor constructor, Object... params)
public static <T> T instantiate(ClassLoader classLoader, String classname, Class<T> returnType)
public static Object instantiateOneArg(ClassLoader classLoader, String className, Class<?> param1Class, Object param1)
public static Object instantiateTwoArgs(ClassLoader classLoader, String className, Class<?> param1Class, Object param1, Class param2Class, Object param2)
public static void invokeSetter(Object o, String name, Class<?> value1clazz, Object value)
public static Object invokeMethodWithArray(Object target, Method method, Object... args)
public static Object invokeMethodWithArray2(Object target, Method method, Object... args) throws InvocationTargetException
InvocationTargetException
public static Object instantiateObject(String className, Class[] types, Object[] params, ClassLoader classLoader)
public static Class<?> tryLoadClass(ClassLoader classLoader, String className)
public static Class<?> loadClass(ClassLoader classLoader, String className)
Copyright © 2004–2015 The Apache Software Foundation. All rights reserved.