org.apache.maven.surefire.util
Class ReflectionUtils

java.lang.Object
  extended by org.apache.maven.surefire.util.ReflectionUtils

public class ReflectionUtils
extends Object

Author:
Kristian Rosenvold

Constructor Summary
ReflectionUtils()
           
 
Method Summary
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 Object instantiate(ClassLoader classLoader, String classname)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getMethod

public static Method getMethod(Object instance,
                               String methodName,
                               Class[] parameters)

getMethod

public static Method getMethod(Class clazz,
                               String methodName,
                               Class[] parameters)

tryGetMethod

public static Method tryGetMethod(Class clazz,
                                  String methodName,
                                  Class[] parameters)

invokeGetter

public static Object invokeGetter(Object instance,
                                  String methodName)

getConstructor

public static Constructor getConstructor(Class clazz,
                                         Class[] arguments)

newInstance

public static Object newInstance(Constructor constructor,
                                 Object[] params)

instantiate

public static Object instantiate(ClassLoader classLoader,
                                 String classname)

instantiateOneArg

public static Object instantiateOneArg(ClassLoader classLoader,
                                       String className,
                                       Class param1Class,
                                       Object param1)

instantiateTwoArgs

public static Object instantiateTwoArgs(ClassLoader classLoader,
                                        String className,
                                        Class param1Class,
                                        Object param1,
                                        Class param2Class,
                                        Object param2)

invokeSetter

public static void invokeSetter(Object o,
                                String name,
                                Class value1clazz,
                                Object value)

invokeSetter

public static Object invokeSetter(Object target,
                                  Method method,
                                  Object value)

invokeMethodWithArray

public static Object invokeMethodWithArray(Object target,
                                           Method method,
                                           Object[] args)

invokeMethodWithArray2

public static Object invokeMethodWithArray2(Object target,
                                            Method method,
                                            Object[] args)
                                     throws InvocationTargetException
Throws:
InvocationTargetException

instantiateObject

public static Object instantiateObject(String className,
                                       Class[] types,
                                       Object[] params,
                                       ClassLoader classLoader)

tryLoadClass

public static Class tryLoadClass(ClassLoader classLoader,
                                 String className)

loadClass

public static Class loadClass(ClassLoader classLoader,
                              String className)


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.