public abstract class AbstractDefaultProcessor extends AbstractProcessor
processingEnv| 构造器和说明 |
|---|
AbstractDefaultProcessor() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
error(String msg,
Element element) |
protected void |
error(String msg,
Element element,
AnnotationMirror annotation) |
protected void |
fatalError(Exception e) |
protected void |
fatalError(String msg) |
protected AnnotationMirror |
getAnnotation(Elements elementUtils,
Element e,
String annotationFullName)
获取注解,支持组合注解
|
protected String |
getQualifiedName(Element element)
获取属性的名称
|
SourceVersion |
getSupportedSourceVersion() |
protected boolean |
isAnnotation(Elements elementUtils,
Element e,
String annotationFullName)
判断是相同的注解,支持组合注解
|
protected boolean |
isAnnotation(String annotationFullName,
AnnotationMirror annotation)
判断是否同一个注解
|
protected boolean |
isClass(Element e)
判断为类
|
protected boolean |
isClassOrInterface(Element e)
判断为类或者接口
|
protected void |
log(String msg) |
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv)
AutoService 注解处理器
|
protected abstract boolean |
processImpl(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, init, isInitializedpublic SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion 在接口中 ProcessorgetSupportedSourceVersion 在类中 AbstractProcessorpublic boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process 在接口中 Processorprocess 在类中 AbstractProcessorannotations - 注解 getSupportedAnnotationTypesroundEnv - 扫描到的 注解新protected abstract boolean processImpl(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
protected boolean isClass(Element e)
e - Elementprotected boolean isClassOrInterface(Element e)
e - Elementprotected AnnotationMirror getAnnotation(Elements elementUtils, Element e, String annotationFullName)
elementUtils - elementUtilse - ElementannotationFullName - annotationFullNameprotected boolean isAnnotation(Elements elementUtils, Element e, String annotationFullName)
elementUtils - elementUtilse - ElementannotationFullName - annotationFullNameprotected boolean isAnnotation(String annotationFullName, AnnotationMirror annotation)
annotationFullName - annotationFullNameannotation - AnnotationMirrorprotected String getQualifiedName(Element element)
element - Elementprotected void log(String msg)
protected void error(String msg, Element element, AnnotationMirror annotation)
protected void fatalError(Exception e)
protected void fatalError(String msg)
Copyright © 2021. All rights reserved.