se.unlogic.standardutils.reflection
Class ReflectionUtils

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

public class ReflectionUtils
extends java.lang.Object


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

isGenericlyTyped

public static boolean isGenericlyTyped(java.lang.reflect.Field field)

getGenericlyTypeCount

public static int getGenericlyTypeCount(java.lang.reflect.Field field)

getGenericlyTypeCount

public static int getGenericlyTypeCount(java.lang.reflect.Method method)

checkGenericTypes

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

getGenericType

public static java.lang.reflect.Type getGenericType(java.lang.reflect.Field field)

getGenericType

public static java.lang.Object getGenericType(java.lang.reflect.Method method)

fixFieldAccess

public static void fixFieldAccess(java.lang.reflect.Field field)

fixMethodAccess

public static void fixMethodAccess(java.lang.reflect.Method method)

getField

public static java.lang.reflect.Field getField(java.lang.Class<?> bean,
                                               java.lang.String fieldName)

isAvailable

public static boolean isAvailable(java.lang.String classname)

getFields

public static java.util.List<java.lang.reflect.Field> getFields(java.lang.Class<?> clazz)

getMethods

public static java.util.List<java.lang.reflect.Method> getMethods(java.lang.Class<?> clazz)

getMethod

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

setFieldValue

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

setMethodValue

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

setSetterMethod

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

getMethod

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


Copyright © 2011. All Rights Reserved.