Class ReflectionUtils


  • public class ReflectionUtils
    extends java.lang.Object
    Author:
    Loc Ha
    • Constructor Summary

      Constructors 
      Constructor Description
      ReflectionUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.annotation.Annotation>
      T
      findAnnotation​(java.lang.Class<?> clazz, java.lang.Class<T> annotationClass)  
      static java.lang.reflect.Field findField​(java.lang.Class<?> clazz, java.lang.String property)  
      static java.lang.reflect.Method findMethod​(java.lang.Class<?> clazz, java.lang.String methodName)  
      static java.util.List<java.lang.reflect.Method> findMethods​(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)  
      static java.lang.Object get​(java.lang.reflect.Field m, java.lang.Object obj)  
      static java.lang.reflect.Method getDeclaredMethod​(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>... parameterTypes)  
      static java.lang.ClassLoader getDefaultClassLoader()  
      static java.lang.Class<?> getListArgType​(java.lang.reflect.Type genericType)  
      static java.lang.Class<?>[] getMapArgTypes​(java.lang.reflect.Type genericType)  
      static java.lang.Object invoke​(java.lang.reflect.Method m, java.lang.Object obj, java.lang.Object... args)  
      static boolean isImplementOf​(java.lang.reflect.Method implMth, java.lang.reflect.Method interfaceMth)  
      static boolean isPublicConst​(int modifier)  
      static <T> java.lang.Class<? extends T> loadClass​(java.lang.String className, java.lang.ClassLoader loader)  
      static <T> T newInstance​(java.lang.Class<T> clazz)  
      static void set​(java.lang.reflect.Field m, java.lang.Object obj, java.lang.Object value)  
      static java.lang.reflect.Field traverse​(java.lang.Class<?> clazz, ReflectionUtils.FieldHandler handler)  
      static java.lang.reflect.Method traverse​(java.lang.Class<?> clazz, ReflectionUtils.MethodHandler handler)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_OBJECTS

        public static final java.lang.Object[] EMPTY_OBJECTS
      • EMPTY_CLASSES

        public static final java.lang.Class<?>[] EMPTY_CLASSES
      • EMPTY_ANNOTATIONS

        public static final java.lang.annotation.Annotation[] EMPTY_ANNOTATIONS
    • Constructor Detail

      • ReflectionUtils

        public ReflectionUtils()
    • Method Detail

      • findMethods

        public static java.util.List<java.lang.reflect.Method> findMethods​(java.lang.Class<?> clazz,
                                                                           java.lang.String methodName,
                                                                           java.lang.Class<?>... parameterTypes)
                                                                    throws ReflectionException
        Throws:
        ReflectionException
      • findAnnotation

        public static <T extends java.lang.annotation.Annotation> T findAnnotation​(java.lang.Class<?> clazz,
                                                                                   java.lang.Class<T> annotationClass)
      • getListArgType

        public static java.lang.Class<?> getListArgType​(java.lang.reflect.Type genericType)
      • getMapArgTypes

        public static java.lang.Class<?>[] getMapArgTypes​(java.lang.reflect.Type genericType)
      • getDefaultClassLoader

        public static java.lang.ClassLoader getDefaultClassLoader()
      • isImplementOf

        public static boolean isImplementOf​(java.lang.reflect.Method implMth,
                                            java.lang.reflect.Method interfaceMth)
      • getDeclaredMethod

        public static java.lang.reflect.Method getDeclaredMethod​(java.lang.Class<?> clazz,
                                                                 java.lang.String name,
                                                                 java.lang.Class<?>... parameterTypes)
      • isPublicConst

        public static boolean isPublicConst​(int modifier)