A
- annotation typepublic class CheckEnclosingAnnotatedProcessor<A extends Annotation> extends AbstractSingleAnnotationProcessor<A>
This is useful in cases where annotations supply only additional informations, but the annotated elements should not be processed as root elements (e.g., method parameters in annotated methods). Usually a warning or error should be issued if such annotations are found without the enclosing element being annotated.
Constructor and Description |
---|
CheckEnclosingAnnotatedProcessor(Class<A> annotationType,
boolean onlyDirect,
Diagnostic.Kind diagnosticKind,
Class<? extends Annotation>... expectedAnnotations)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
process(Element elem,
AnnotationMirror annotation,
A annotationObject,
APUtils utils)
Process a single annotated element.
|
getAnnotationType, post, postFailure, pre
@SafeVarargs public CheckEnclosingAnnotatedProcessor(Class<A> annotationType, boolean onlyDirect, Diagnostic.Kind diagnosticKind, Class<? extends Annotation>... expectedAnnotations)
annotationType
- the annotation type to checkonlyDirect
- whether or not to consider only the directly enclosing element, or all ancestorsdiagnosticKind
- the diagnostic kind to use if the enclosing element is not annotated with one of
the expected annotations.expectedAnnotations
- the expected annotations of the enclosing elementspublic void process(Element elem, AnnotationMirror annotation, A annotationObject, APUtils utils) throws Exception, ProcessingException
SingleAnnotationProcessorModule
process
in interface SingleAnnotationProcessorModule<A extends Annotation>
process
in class AbstractSingleAnnotationProcessor<A extends Annotation>
elem
- the element to processannotation
- the annotation mirror corresponding to the
annotation to process.annotationObject
- the annotation object corresponding to the annotation
to process.utils
- the utility objectException
- if an error occursProcessingException
- if a processing-related error occursCopyright © 2013–2014. All rights reserved.