public abstract class AbstractSingularAnnotationProcessor<A extends Annotation,E extends Element> extends AbstractProcessor
Modifier and Type | Field and Description |
---|---|
protected Elements |
elementUtils |
protected Types |
typeUtils |
processingEnv
Constructor and Description |
---|
AbstractSingularAnnotationProcessor() |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getSupportedAnnotationTypes() |
SourceVersion |
getSupportedSourceVersion() |
void |
init(ProcessingEnvironment processingEnv) |
protected boolean |
isImplementedByInterface(TypeElement element,
String interfaceName)
This method recursively checks whether a given interface is implemented by a given type element or by at least
one of the interfaces of its hierarchy
|
protected boolean |
isImplementedBySuper(TypeElement element,
String interfaceName)
This method checks whether a given interface is implemented by at least one of the super classes of given type
element
|
protected boolean |
isInterfaceImplemented(TypeElement element,
String interfaceName)
This method combines
isImplementedByInterface(TypeElement, String) and
isImplementedBySuper(TypeElement, String) methods |
protected boolean |
isOfElementKinds(EnumSet<ElementKind> elementKinds,
Element element)
This method checks whether the given element belongs to one of the given element kinds
|
protected void |
printError(String msg,
Element e,
Object... args)
This method writes an error kind message to the provided
Messager |
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
protected abstract void |
processRules(SingularAnnotationProcessingContext<A,E> sapc) |
protected abstract boolean |
validateElementKind(Element element) |
getCompletions, getSupportedOptions, isInitialized
public void init(ProcessingEnvironment processingEnv)
init
in interface Processor
init
in class AbstractProcessor
public SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion
in interface Processor
getSupportedSourceVersion
in class AbstractProcessor
public Set<String> getSupportedAnnotationTypes()
getSupportedAnnotationTypes
in interface Processor
getSupportedAnnotationTypes
in class AbstractProcessor
public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process
in interface Processor
process
in class AbstractProcessor
protected abstract boolean validateElementKind(Element element)
protected abstract void processRules(SingularAnnotationProcessingContext<A,E> sapc)
protected boolean isOfElementKinds(EnumSet<ElementKind> elementKinds, Element element)
elementKinds
- Set of ElementKind
to check againstelement
- Element
to be validatedprotected void printError(String msg, Element e, Object... args)
Messager
msg
- Error message contente
- Element related to the error messageargs
- list of arguments for the message contentprotected boolean isImplementedByInterface(TypeElement element, String interfaceName)
element
- type element to be checkedinterfaceName
- name of the interface to be checked againstprotected boolean isInterfaceImplemented(TypeElement element, String interfaceName)
isImplementedByInterface(TypeElement, String)
and
isImplementedBySuper(TypeElement, String)
methodselement
- type element to be checkedinterfaceName
- name of the interface to be checked againstprotected boolean isImplementedBySuper(TypeElement element, String interfaceName)
element
- type element to be checkedinterfaceName
- name of the interface to be checked againstCopyright © 2016–2019 AdroitLogic. All rights reserved.