类 AutoServiceProcessor
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- com.codedreamplus.auto.service.AutoServiceProcessor
-
- 所有已实现的接口:
Processor
@SupportedOptions("debug") public class AutoServiceProcessor extends AbstractProcessor
java spi 服务自动处理器 参考:google auto生成spi服务文件 可通过
ServiceLoader.load(Class)加载注解AutoService.value()指定的父类接口下的实现类- 作者:
- mo
-
-
字段概要
-
从类继承的字段 javax.annotation.processing.AbstractProcessor
processingEnv
-
-
构造器概要
构造器 构造器 说明 AutoServiceProcessor()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 AnnotationValuegetAnnotationValue(AnnotationMirror annotationMirror, String elementName)Returns aExecutableElementand its associatedAnnotationValueif such an element was either declared in the usage represented by the providedAnnotationMirror, or if such an element was defined with a default.Map<ExecutableElement,AnnotationValue>getAnnotationValuesWithDefaults(AnnotationMirror annotation)Returns theAnnotationMirror's map ofAnnotationValueindexed byExecutableElement, supplying default values from the annotation if the annotation property has not been set.Set<String>getSupportedAnnotationTypes()获取所支持的所有注解类型voidinit(ProcessingEnvironment env)booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)-
从类继承的方法 javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedOptions, getSupportedSourceVersion, isInitialized
-
-
-
-
方法详细资料
-
init
public void init(ProcessingEnvironment env)
- 指定者:
init在接口中Processor- 覆盖:
init在类中AbstractProcessor
-
process
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
- 指定者:
process在接口中Processor- 指定者:
process在类中AbstractProcessor
-
getSupportedAnnotationTypes
public Set<String> getSupportedAnnotationTypes()
获取所支持的所有注解类型- 指定者:
getSupportedAnnotationTypes在接口中Processor- 覆盖:
getSupportedAnnotationTypes在类中AbstractProcessor
-
getAnnotationValue
public AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror, String elementName)
Returns aExecutableElementand its associatedAnnotationValueif such an element was either declared in the usage represented by the providedAnnotationMirror, or if such an element was defined with a default.- 参数:
annotationMirror- AnnotationMirrorelementName- elementName- 返回:
- AnnotationValue map
- 抛出:
IllegalArgumentException- if no element is defined with the given elementName.
-
getAnnotationValuesWithDefaults
public Map<ExecutableElement,AnnotationValue> getAnnotationValuesWithDefaults(AnnotationMirror annotation)
Returns theAnnotationMirror's map ofAnnotationValueindexed byExecutableElement, supplying default values from the annotation if the annotation property has not been set. This is equivalent toElements.getElementValuesWithDefaults(AnnotationMirror)but can be called statically without anElementsinstance.The iteration order of elements of the returned map will be the order in which the
ExecutableElements are defined inannotation's type.- 参数:
annotation- AnnotationMirror- 返回:
- AnnotationValue Map
-
-