se.unlogic.standardutils.reflection
Class ReflectionUtils

java.lang.Object
  extended by se.unlogic.standardutils.reflection.ReflectionUtils

public class ReflectionUtils
extends Object


Constructor Summary
ReflectionUtils()
           
 
Method Summary
static boolean checkGenericTypes(Field field, Class<?>... classes)
           
static void fixFieldAccess(Field field)
           
static void fixMethodAccess(Method method)
           
static Field getField(Class<?> bean, String fieldName)
           
static List<Field> getFields(Class<?> clazz)
           
static int getGenericlyTypeCount(Field field)
           
static int getGenericlyTypeCount(Method method)
           
static Type getGenericType(Field field)
           
static Object getGenericType(Method method)
           
static Object getInstance(String className)
           
static Method getMethod(Class<?> clazz, String methodName, Class<?> returnType, Class<?>... inputParams)
           
static Method getMethod(Class<?> clazz, String methodName, int argumentCount)
           
static List<Method> getMethods(Class<?> clazz)
           
static boolean isAvailable(String classname)
           
static boolean isGenericlyTyped(Field field)
           
static void setFieldValue(Field field, Object value, Object target)
           
static void setMethodValue(Method method, Object value, Object target)
           
static boolean setSetterMethod(Object target, String methodName, String value)
           
 
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

getInstance

public static Object getInstance(String className)
                          throws NoClassDefFoundError,
                                 ClassNotFoundException,
                                 InstantiationException,
                                 IllegalAccessException
Throws:
NoClassDefFoundError
ClassNotFoundException
InstantiationException
IllegalAccessException

isGenericlyTyped

public static boolean isGenericlyTyped(Field field)

getGenericlyTypeCount

public static int getGenericlyTypeCount(Field field)

getGenericlyTypeCount

public static int getGenericlyTypeCount(Method method)

checkGenericTypes

public static boolean checkGenericTypes(Field field,
                                        Class<?>... classes)

getGenericType

public static Type getGenericType(Field field)

getGenericType

public static Object getGenericType(Method method)

fixFieldAccess

public static void fixFieldAccess(Field field)

fixMethodAccess

public static void fixMethodAccess(Method method)

getField

public static Field getField(Class<?> bean,
                             String fieldName)

isAvailable

public static boolean isAvailable(String classname)

getFields

public static List<Field> getFields(Class<?> clazz)

getMethods

public static List<Method> getMethods(Class<?> clazz)

getMethod

public static Method getMethod(Class<?> clazz,
                               String methodName,
                               Class<?> returnType,
                               Class<?>... inputParams)

setFieldValue

public static void setFieldValue(Field field,
                                 Object value,
                                 Object target)
                          throws IllegalArgumentException,
                                 IllegalAccessException
Throws:
IllegalArgumentException
IllegalAccessException

setMethodValue

public static void setMethodValue(Method method,
                                  Object value,
                                  Object target)
                           throws IllegalArgumentException,
                                  IllegalAccessException,
                                  InvocationTargetException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

setSetterMethod

public static boolean setSetterMethod(Object target,
                                      String methodName,
                                      String value)
                               throws IllegalArgumentException,
                                      IllegalAccessException,
                                      InvocationTargetException,
                                      MethodNotFoundException,
                                      UnableToFindSuitablePopulatorException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException
MethodNotFoundException
UnableToFindSuitablePopulatorException

getMethod

public static Method getMethod(Class<?> clazz,
                               String methodName,
                               int argumentCount)


Copyright © 2011. All Rights Reserved.