public abstract class AbstractProcessor extends Object implements Processor
吸气的方法可能issue warnings值得注意的条件下使用的设施后可用的处理器已经initialized。
派生类可以重写和任何这类的方法规范的实现只要对法的一般Processor合同服从。
| Modifier and Type | Field and Description |
|---|---|
protected ProcessingEnvironment |
processingEnv
工具框架提供的处理环境。
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractProcessor()
子类的构造函数调用。
|
| Modifier and Type | Method and Description |
|---|---|
Iterable<? extends Completion> |
getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText)
返回一个完成空。
|
Set<String> |
getSupportedAnnotationTypes()
如果处理器类注释与
SupportedAnnotationTypes,返回一个具有相同的字符串设置为注释不可修改的设置。
|
Set<String> |
getSupportedOptions()
如果处理器类注释与
SupportedOptions,返回一个具有相同的字符串设置为注释不可修改的设置。
|
SourceVersion |
getSupportedSourceVersion()
如果处理器类注释在注释
SupportedSourceVersion,返回源代码版本。
|
void |
init(ProcessingEnvironment processingEnv)
初始化处理器的处理环境,通过设置
processingEnv场的
processingEnv参数的值。
|
protected boolean |
isInitialized()
|
abstract boolean |
process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
处理来自于前一轮的类型元素的注释类型的集合,并返回是否这些注释类型所要求的这些注释类型。
|
protected ProcessingEnvironment processingEnv
public Set<String> getSupportedOptions()
SupportedOptions,返回一个具有相同的字符串设置为注释不可修改的设置。如果类没有如此注释,则返回一个空集。
getSupportedOptions 接口
Processor
SupportedOptions
public Set<String> getSupportedAnnotationTypes()
SupportedAnnotationTypes,返回一个具有相同的字符串设置为注释不可修改的设置。如果类没有如此注释,则返回一个空集。
getSupportedAnnotationTypes 接口
Processor
SupportedAnnotationTypes
public SourceVersion getSupportedSourceVersion()
SupportedSourceVersion,返回源代码版本。如果类不注明,
SourceVersion.RELEASE_6返回。
getSupportedSourceVersion 接口
Processor
SupportedSourceVersion,
ProcessingEnvironment.getSourceVersion()
public void init(ProcessingEnvironment processingEnv)
processingEnv场的
processingEnv参数的值。一个
IllegalStateException将如果调用此方法不止一次的对同一对象的投。
init 接口
Processor
processingEnv环境访问设施的工具框架提供给处理器
IllegalStateException不止一次。
public abstract boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
true返回,注释类型都声称和随后的处理器将不会被要求处理;如果
false返回,注释类型认领和随后的处理器可能会被要求处理。处理器可能总是返回相同的布尔值,或根据选择的标准可能会改变结果。
输入将空如果处理器支持"*"和根元素没有注释。一个Processor必须妥善处理注释空集。
public Iterable<? extends Completion> getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText)
getCompletions 接口
Processor
element被注释的元素
annotation -(也许部分)注释被应用到元素
member -注释成员返回可能的完成
userText源代码的文本来完成的
protected boolean isInitialized()
true如果这个对象被初始化,否则
false。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.