public class ReflectionUtils extends Object
Constructor and Description |
---|
ReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
static List<Field> |
getAllAnnotatedFields(Class<?> clazz,
Class<? extends Annotation> annotationClass) |
static Field |
getField(Class<?> clazz,
String fieldName)
Climb the class hierarchy starting with the clazz provided, looking for the field with fieldName
|
static Class<?> |
getFirstAnnotatedClass(Class<?> clazz,
Class<? extends Annotation> annotationClass) |
static Field |
getFirstAnnotatedField(Class<?> clazz,
Class<? extends Annotation> annotationClass) |
static Method |
getFirstAnnotatedMethod(Class<?> clazz,
Class<? extends Annotation> annotationClass) |
static <T extends Annotation> |
getFirstClassAnnotation(Class<?> clazz,
Class<T> annotationClass) |
static Field |
getReferencedField(Class<?> clazz,
Class<? extends Annotation> annotationClass) |
static boolean |
isAnnotationPresent(Class<?> clazz,
Class<? extends Annotation> annotationClass) |
static boolean |
isGetter(Method method) |
static boolean |
isSetter(Method method) |
static String |
toFieldName(Method getterOrSetter) |
public static Field getFirstAnnotatedField(Class<?> clazz, Class<? extends Annotation> annotationClass)
public static List<Field> getAllAnnotatedFields(Class<?> clazz, Class<? extends Annotation> annotationClass)
public static Method getFirstAnnotatedMethod(Class<?> clazz, Class<? extends Annotation> annotationClass)
public static Class<?> getFirstAnnotatedClass(Class<?> clazz, Class<? extends Annotation> annotationClass)
public static <T extends Annotation> T getFirstClassAnnotation(Class<?> clazz, Class<T> annotationClass)
public static boolean isAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotationClass)
public static boolean isGetter(Method method)
public static boolean isSetter(Method method)
public static Field getReferencedField(Class<?> clazz, Class<? extends Annotation> annotationClass)
public static Field getField(Class<?> clazz, String fieldName)
clazz
- starting class to search atfieldName
- name of the field we are looking forCopyright © 2016. All rights reserved.