public class AnnotationAnalyzer extends Object
| Constructor and Description |
|---|
AnnotationAnalyzer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(AnnotatedElement element,
Annotation annotation)
Add an annotation to element, which must be a Class, Method,
or Constructor.
|
void |
addInheritedAnnotations(Class<?> cls,
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 Annotation> |
getAnnotation(AnnotatedElement elem,
Class<A> cls) |
Map<Class<?>,Annotation> |
getAnnotations(AnnotatedElement elem)
Return all annotations on the element, including any added annotations.
|
Map<Class<?>,Annotation> |
getAnnotations(Class<?> cls)
Return a map of all annotations defined on cls and its super
classes and interfaces in ClassAnalyzer order.
|
Map<Class<?>,Annotation> |
getAnnotations(Constructor<?> cons)
Same as cons.getAnnotations, with the result converted to a map.
|
Map<Class<?>,Annotation> |
getAnnotations(Field fld)
Same as fld.getAnnotations, with the result converted to a map.
|
Map<Class<?>,Annotation> |
getAnnotations(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.
|
Map<Class<?>,Annotation> |
getAnnotations(Package pkg)
Same as pkg.getAnnotations, with the result converted to a map.
|
List<Map<Class<?>,Annotation>> |
getParameterAnnotations(Constructor<?> cons)
Same as cons.getParameterAnnotations, with the result converted to a
list of maps.
|
List<Map<Class<?>,Annotation>> |
getParameterAnnotations(Method method)
Same as cons.getParameterAnnotations, with the result converted to a
list of maps.
|
public void addAnnotation(AnnotatedElement element, Annotation annotation)
element - annotation - public void addInheritedAnnotations(Class<?> cls, Class<?> ancestor)
cls - public Map<Class<?>,Annotation> getAnnotations(Class<?> cls)
cls - Class to analyze.public Map<Class<?>,Annotation> getAnnotations(Method method)
method - The method to analyzepublic List<Map<Class<?>,Annotation>> getParameterAnnotations(Method method)
cons - A Java Constructorpublic Map<Class<?>,Annotation> getAnnotations(Constructor<?> cons)
cons - A Java Constructorpublic List<Map<Class<?>,Annotation>> getParameterAnnotations(Constructor<?> cons)
cons - A Java Constructorpublic Map<Class<?>,Annotation> getAnnotations(Field fld)
fld - A Java Fieldpublic Map<Class<?>,Annotation> getAnnotations(Package pkg)
pkg - A Java Packagepublic Map<Class<?>,Annotation> getAnnotations(AnnotatedElement elem)
elem - AnnotatedElementpublic <A extends Annotation> A getAnnotation(AnnotatedElement elem, Class<A> cls)
Copyright © 2017 Oracle. All rights reserved.