Class ClassUtils


  • public class ClassUtils
    extends Object
    Author:
    Rui Gu (https://github.com/jackygurui) Modified
    • Constructor Detail

      • ClassUtils

        public ClassUtils()
    • Method Detail

      • setField

        public static void setField​(Object obj,
                                    String fieldName,
                                    Object value)
      • getAnnotation

        public static <T extends Annotation> T getAnnotation​(Class<?> clazz,
                                                             String fieldName,
                                                             Class<T> annotationClass)
      • getAnnotation

        public static <T extends Annotation> T getAnnotation​(Class<?> clazz,
                                                             Class<T> annotationClass)
      • getField

        public static <T> T getField​(Object obj,
                                     String fieldName)
      • isAnnotationPresent

        public static boolean isAnnotationPresent​(Class<?> clazz,
                                                  Class<? extends Annotation> annotation)
      • searchForMethod

        public static Method searchForMethod​(Class<?> type,
                                             String name,
                                             Class<?>[] parms)
        Searches through all methods looking for one with the specified name that will take the specified paramaters even if the parameter types are more generic in the actual method implementation. This is similar to the findConstructor() method and has the similar limitations that it doesn't do a real widening scope search and simply processes the methods in order.
        Parameters:
        type - param
        name - of class
        parms - classes
        Returns:
        Method object