public final class ReflectionUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Annotation> |
getAnnotation(AccessibleObject aObject,
Class<T> aAnnotationClass)
Equivalent to
AccessibleObject.getAnnotation(Class) but handles uimaFIT legacy
annotations. |
static <T extends Annotation> |
getAnnotation(Class<?> aObject,
Class<T> aAnnotationClass)
Equivalent to
Class.getAnnotation(Class) but handles uimaFIT legacy annotations. |
static Field |
getField(Class<?> aClass,
String aName)
Get the given field from the class or the first superclass that declares it.
|
static Field |
getField(Object aObject,
String aName)
Get the given field of the passed in object from its class or the first superclass that
declares it.
|
static List<Field> |
getFields(Class<?> aClass)
Get all the fields for this class and all of its superclasses
|
static List<Field> |
getFields(Object aObject)
Get all the fields for the class (and superclasses) of the passed in object
|
static <T extends Annotation> |
getInheritableAnnotation(Class<T> aAnnotation,
Class<?> aClass)
Search for an annotation of the specified type starting on the given class and tracking back
the inheritance hierarchy.
|
static boolean |
isAnnotationPresent(AccessibleObject aObject,
Class<? extends Annotation> aAnnotationClass)
Equivalent to
AccessibleObject.isAnnotationPresent(Class) but handles uimaFIT legacy
annotations. |
static boolean |
isAnnotationPresent(Class<?> aObject,
Class<? extends Annotation> aAnnotationClass)
Equivalent to
Class.isAnnotationPresent(Class) but handles uimaFIT legacy annotations. |
public static List<Field> getFields(Object aObject)
aObject
- any object will dopublic static List<Field> getFields(Class<?> aClass)
aClass
- any class will dopublic static Field getField(Object aObject, String aName) throws NoSuchFieldException
aObject
- any object will doaName
- the name of the fieldNoSuchFieldException
- if there is no such fieldpublic static Field getField(Class<?> aClass, String aName) throws NoSuchFieldException
aClass
- any class will doaName
- the field nameNoSuchFieldException
- if there is no such fieldpublic static <T extends Annotation> T getInheritableAnnotation(Class<T> aAnnotation, Class<?> aClass)
T
- the annotation typeaAnnotation
- the annotation classaClass
- the class to start searching onnull
if it could not be foundpublic static boolean isAnnotationPresent(AccessibleObject aObject, Class<? extends Annotation> aAnnotationClass)
AccessibleObject.isAnnotationPresent(Class)
but handles uimaFIT legacy
annotations.aObject
- the object to analyzeaAnnotationClass
- the annotation to check forpublic static boolean isAnnotationPresent(Class<?> aObject, Class<? extends Annotation> aAnnotationClass)
Class.isAnnotationPresent(Class)
but handles uimaFIT legacy annotations.aObject
- the object to analyzeaAnnotationClass
- the annotation to check forpublic static <T extends Annotation> T getAnnotation(AccessibleObject aObject, Class<T> aAnnotationClass)
AccessibleObject.getAnnotation(Class)
but handles uimaFIT legacy
annotations.T
- the annotation typeaObject
- the object to analyzeaAnnotationClass
- the annotation to check forpublic static <T extends Annotation> T getAnnotation(Class<?> aObject, Class<T> aAnnotationClass)
Class.getAnnotation(Class)
but handles uimaFIT legacy annotations.T
- the annotation typeaObject
- the object to analyzeaAnnotationClass
- the annotation to check forCopyright © 2012–2022 The Apache Software Foundation. All rights reserved.