public class ReflectUtil extends Object
| 构造器和说明 |
|---|
ReflectUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <A extends Annotation> |
findAnnotation(Class claz,
Class<A> ann) |
static Class<? extends Annotation> |
findAnnotationClassByAnnotationType(Class clazz,
Collection<Class<? extends Annotation>> annotations) |
static Class |
findClassByAnnotation(Class claz,
Class<? extends Annotation> ann) |
static Class<?> |
forName(String name,
ClassLoader classLoader) |
static Field |
getAccessibleField(Object obj,
String fieldName)
Loop up to get the DeclaredField of the object and force it to be accessible.
|
static Method |
getAccessibleMethod(Class clazz,
String methodName,
Class<?>... parameterTypes)
Loop up to get the DeclaredMethod for the object and force it to be accessible.
|
static Map<String,Object> |
getAnnotationValueMap(Annotation annotation) |
static String |
getClassFileName(Class<?> clazz)
Determine the name of the class file, relative to the containing
package: e.g.
|
static ClassLoader |
getDefaultClassLoader() |
static Object |
getFieldValue(Object obj,
String fieldName)
Read the object property values directly, ignoring the private/protected modifier, without going through the getter function.
|
static Class[] |
getInterfaces(Class sourceClass) |
static boolean |
hasInterface(Class sourceClass) |
static boolean |
hasParameterAnnotation(Class sourceClass,
Collection<Class<? extends Annotation>> parameterAnnotations) |
static Class<?> |
resolveClassName(String className,
ClassLoader classLoader) |
public static Class<?> resolveClassName(String className, ClassLoader classLoader) throws IllegalArgumentException
public static Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException, LinkageError
public static ClassLoader getDefaultClassLoader()
public static boolean hasInterface(Class sourceClass)
public static boolean hasParameterAnnotation(Class sourceClass, Collection<Class<? extends Annotation>> parameterAnnotations)
public static Class findClassByAnnotation(Class claz, Class<? extends Annotation> ann)
public static <A extends Annotation> A findAnnotation(Class claz, Class<A> ann)
public static Class<? extends Annotation> findAnnotationClassByAnnotationType(Class clazz, Collection<Class<? extends Annotation>> annotations)
public static Map<String,Object> getAnnotationValueMap(Annotation annotation)
public static Object getFieldValue(Object obj, String fieldName)
obj - objfieldName - fieldNamepublic static Field getAccessibleField(Object obj, String fieldName)
obj - objfieldName - fieldNamepublic static Method getAccessibleMethod(Class clazz, String methodName, Class<?>... parameterTypes)
clazz - classmethodName - methodNameparameterTypes - parameterTypesCopyright © 2021. All rights reserved.