public class AnnotationAnalyzer
extends java.lang.Object
Constructor and Description |
---|
AnnotationAnalyzer() |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.annotation.Annotation annotation)
Add an annotation to element, which must be a Class, Method,
or Constructor.
|
void |
addInheritedAnnotations(java.lang.Class<?> cls,
java.lang.Class<?> ancestor)
Add all annotations on cls (including inherited annotations
and its methods (including overridden methods in super classes and
interfaces) to super (which must be a super class or interface of cls).
|
<A extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.reflect.AnnotatedElement elem,
java.lang.Class<A> cls) |
java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> |
getAnnotations(java.lang.reflect.AnnotatedElement elem)
Return all annotations on the element, including any added annotations.
|
java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> |
getAnnotations(java.lang.Class<?> cls)
Return a map of all annotations defined on cls and its super
classes and interfaces in ClassAnalyzer order.
|
java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> |
getAnnotations(java.lang.reflect.Constructor<?> cons)
Same as cons.getAnnotations, with the result converted to a map.
|
java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> |
getAnnotations(java.lang.reflect.Field fld)
Same as fld.getAnnotations, with the result converted to a map.
|
java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> |
getAnnotations(java.lang.reflect.Method method)
Return a map of all annotations defined in method and its overriden
methods in the inheritance order of the ClassAnalyzer for the method's
defining class.
|
java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> |
getAnnotations(java.lang.Package pkg)
Same as pkg.getAnnotations, with the result converted to a map.
|
java.util.List<java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation>> |
getParameterAnnotations(java.lang.reflect.Constructor<?> cons)
Same as cons.getParameterAnnotations, with the result converted to a
list of maps.
|
java.util.List<java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation>> |
getParameterAnnotations(java.lang.reflect.Method method)
Same as cons.getParameterAnnotations, with the result converted to a
list of maps.
|
public void addAnnotation(java.lang.reflect.AnnotatedElement element, java.lang.annotation.Annotation annotation)
element
- annotation
- public void addInheritedAnnotations(java.lang.Class<?> cls, java.lang.Class<?> ancestor)
cls
- public java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> getAnnotations(java.lang.Class<?> cls)
cls
- Class to analyze.public java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> getAnnotations(java.lang.reflect.Method method)
method
- The method to analyzepublic java.util.List<java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation>> getParameterAnnotations(java.lang.reflect.Method method)
cons
- A Java Constructorpublic java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> getAnnotations(java.lang.reflect.Constructor<?> cons)
cons
- A Java Constructorpublic java.util.List<java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation>> getParameterAnnotations(java.lang.reflect.Constructor<?> cons)
cons
- A Java Constructorpublic java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> getAnnotations(java.lang.reflect.Field fld)
fld
- A Java Fieldpublic java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> getAnnotations(java.lang.Package pkg)
pkg
- A Java Packagepublic java.util.Map<java.lang.Class<?>,java.lang.annotation.Annotation> getAnnotations(java.lang.reflect.AnnotatedElement elem)
elem
- AnnotatedElementpublic <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.reflect.AnnotatedElement elem, java.lang.Class<A> cls)