类 ReflectionUtils


  • public class ReflectionUtils
    extends Object
    • 构造器详细资料

      • ReflectionUtils

        public ReflectionUtils()
    • 方法详细资料

      • isReadMethod

        public static boolean isReadMethod​(Method method)
      • isWriteMethod

        public static boolean isWriteMethod​(Method method)
      • findReadMethod

        public static Method findReadMethod​(Class<?> clazz,
                                            String propertyName)
      • findWriteMethod

        public static Method findWriteMethod​(Class<?> clazz,
                                             String propertyName)
      • findMethodByName

        public static Method findMethodByName​(Class<?> clazz,
                                              String name)
      • getMethodList

        public static List<Method> getMethodList​(Class<?> clazz,
                                                 int... modifiers)
      • getMethodAnnotation

        public static <A extends Annotation> A getMethodAnnotation​(Class<?> clazz,
                                                                   Method method,
                                                                   Class<A> annotationClazz)
      • getAllInterfaces

        public static List<Class<?>> getAllInterfaces​(Class<?> clazz)
      • findMethod

        public static Method findMethod​(Class<?> clazz,
                                        String name,
                                        Class<?>... parameterTypes)
        根据Class方法名获取对应方法
        参数:
        clazz - Class
        name - 方法名
        parameterTypes - Class...
        返回:
        Method
      • findMethodWithReturnType

        public static Method findMethodWithReturnType​(Class<?> clazz,
                                                      String name,
                                                      Type returnType)
      • invokeMethod

        public static Object invokeMethod​(Method method,
                                          Object target,
                                          Object... args)
        调用反射方法
        参数:
        method - Method
        target - Object
        args - arguments
        返回:
        Object for result
      • invokeWriteMethod

        public static void invokeWriteMethod​(Object target,
                                             String propertyName,
                                             Object arg)
      • invokeReadMethod

        public static Object invokeReadMethod​(Object target,
                                              String propertyName)
      • getFiledList

        public static List<Field> getFiledList​(Class<?> clazz,
                                               int... modifiers)
      • findFieldOfReadMethod

        public static Field findFieldOfReadMethod​(Method readMethod)
      • findFieldOfWriteMethod

        public static Field findFieldOfWriteMethod​(Method writeMethod)
      • getFieldValue

        public static Object getFieldValue​(Object target,
                                           String propertyName)
      • setFieldValue

        public static void setFieldValue​(Object target,
                                         String propertyName,
                                         Object value)
      • getAnnotation

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

        public static <T extends Annotation> T getAnnotation​(Method method,
                                                             Class<T> annotationClass)
      • isValidBeanProperty

        public static boolean isValidBeanProperty​(Class<?> type,
                                                  Field property)