public abstract class XAbstractProcessor extends AbstractProcessor implements CommonUtil
Differences with AbstractProcessor:
SupportedAnnotation to define supported annotation by Class
instead of String| Modifier and Type | Class and Description |
|---|---|
protected class |
XAbstractProcessor.Assert<T>
ASSERT
|
protected class |
XAbstractProcessor.Log |
CommonUtil.ActionE0<E extends Exception>, CommonUtil.FuncE0<R,E extends Exception>| Modifier and Type | Field and Description |
|---|---|
protected Elements |
elements |
protected Filer |
filer |
protected boolean |
isDebug |
protected Messager |
messager |
protected Types |
types |
processingEnv| Constructor and Description |
|---|
XAbstractProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected <T> XAbstractProcessor.Assert<T> |
assertDo(Callable<T> task) |
protected XAbstractProcessor.Assert<Void> |
assertDo(CommonUtil.ActionE0<?> task) |
protected <T> XAbstractProcessor.Assert<T> |
assertNonNull(T t) |
protected XAbstractProcessor.Assert<Void> |
assertThat(boolean b) |
protected <T> XAbstractProcessor.Assert<T> |
assertThat(T t,
boolean b) |
protected <T> XAbstractProcessor.Assert<T> |
assertThat(T t,
Predicate<T> b) |
protected <T> XAbstractProcessor.Assert<T> |
assertType(Object o,
Class<T> clz) |
protected XAbstractProcessor.Log |
debug()
LOG
|
protected XAbstractProcessor.Log |
error() |
Set<String> |
getSupportedAnnotationTypes()
If the processor class is annotated with
SupportedAnnotation or
SupportedAnnotationTypes, return an unmodifiable set with the same
set of strings as the annotation. |
protected void |
handleAssert(Runnable task)
Override this method to do something for
AssertException.The default behavior is log the message as error if present. |
void |
init(ProcessingEnvironment processingEnv) |
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv)
|
abstract boolean |
processActual(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv)
Processes a set of annotation types on type elements originating from the
prior round and returns whether or not these annotation types are claimed
by this processor.
|
protected XAbstractProcessor.Log |
warning() |
getCompletions, getSupportedOptions, getSupportedSourceVersion, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitensureFileSystem, getStackTraceString, throwAsUncheck, uncatch, uncatch, uncheck, uncheckprotected Types types
protected Elements elements
protected Messager messager
protected Filer filer
protected boolean isDebug
public void init(ProcessingEnvironment processingEnv)
init in interface Processorinit in class AbstractProcessorpublic final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process in interface Processorprocess in class AbstractProcessorpublic abstract boolean processActual(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws AssertException
true is returned, the annotation types are claimed and subsequent
processors will not be asked to process them; if false is returned,
the annotation types are unclaimed and subsequent processors may be asked
to process them. A processor may always return the same boolean value or
may vary the result based on chosen criteria.
The input set will be empty if the processor supports "*" and the root elements have no annotations. A Processor must gracefully handle an empty set of annotations.
annotations - the annotation types requested to be processedroundEnv - environment for information about the current and prior
roundAssertException - throw the AssertException to quit the process
directlyassertThat(boolean),
handleAssert(Runnable)protected void handleAssert(Runnable task)
AssertException.task - task who will throw AssertExceptionpublic Set<String> getSupportedAnnotationTypes()
SupportedAnnotation or
SupportedAnnotationTypes, return an unmodifiable set with the same
set of strings as the annotation. If the class is not so annotated, an
empty set is returned.getSupportedAnnotationTypes in interface ProcessorgetSupportedAnnotationTypes in class AbstractProcessorprotected <T> XAbstractProcessor.Assert<T> assertThat(T t, Predicate<T> b)
protected <T> XAbstractProcessor.Assert<T> assertThat(T t, boolean b)
protected XAbstractProcessor.Assert<Void> assertThat(boolean b)
protected <T> XAbstractProcessor.Assert<T> assertType(Object o, Class<T> clz)
protected <T> XAbstractProcessor.Assert<T> assertNonNull(T t)
protected <T> XAbstractProcessor.Assert<T> assertDo(Callable<T> task)
protected XAbstractProcessor.Assert<Void> assertDo(CommonUtil.ActionE0<?> task)
protected XAbstractProcessor.Log debug()
protected XAbstractProcessor.Log warning()
protected XAbstractProcessor.Log error()
Copyright © 2018. All rights reserved.