- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- eu.ess.xaos.tools.lang.AbstractAnnotationProcessor
-
- All Implemented Interfaces:
Processor
public abstract class AbstractAnnotationProcessor extends AbstractProcessor
AnAbstractProcessor
with some common utilities.- Author:
- claudiorosati
-
-
Field Summary
-
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
-
Constructor Summary
Constructors Constructor Description AbstractAnnotationProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
binaryName(TypeElement element)
protected AnnotationMirror
findAnnotationMirror(Element element, Class<? extends Annotation> annotation)
Returns the mirror for the givenannotation
.protected AnnotationValue
findAnnotationValue(AnnotationMirror annotation, String name)
Returns the value for the givenannotation
.protected Elements
getElements()
protected ProcessingEnvironment
getEnvironment()
A clean way of accessingAbstractProcessor.processingEnv
.protected Filer
getFiler()
protected Messager
getMessager()
protected Types
getTypes()
-
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, init, isInitialized, process
-
-
-
-
Method Detail
-
binaryName
protected String binaryName(TypeElement element)
- Parameters:
element
- TheTypeElement
whose binary name must be returned.- Returns:
- The binary name of the given
element
.
-
findAnnotationMirror
protected AnnotationMirror findAnnotationMirror(Element element, Class<? extends Annotation> annotation)
Returns the mirror for the givenannotation
.- Parameters:
element
- A source element.annotation
- A type of annotation.- Returns:
- The instance of that annotation on the element, or
null
if not found.
-
findAnnotationValue
protected AnnotationValue findAnnotationValue(AnnotationMirror annotation, String name)
Returns the value for the givenannotation
.- Parameters:
annotation
- An annotation instance (null
permitted).name
- The name of an attribute of that annotation.- Returns:
- The corresponding annotation value if found.
-
getElements
protected Elements getElements()
- Returns:
ProcessingEnvironment.getElementUtils()
.
-
getEnvironment
protected ProcessingEnvironment getEnvironment()
A clean way of accessingAbstractProcessor.processingEnv
.- Returns:
AbstractProcessor.processingEnv
.
-
getFiler
protected Filer getFiler()
- Returns:
ProcessingEnvironment.getFiler()
.
-
getMessager
protected Messager getMessager()
- Returns:
- The
Messager
used to report errors, warnings, and other notices.
-
getTypes
protected Types getTypes()
- Returns:
ProcessingEnvironment.getTypeUtils()
.
-
-