public abstract class AbstractProcessor extends AbstractProcessor implements JavaLangReflectMethods
AbstractProcessor by
providing a getSupportedSourceVersion() implementation, methods
to report Diagnostic.Kind.ERRORs and
Diagnostic.Kind.WARNINGs, and access to
ProcessingEnvironment.getFiler(),
ProcessingEnvironment.getElementUtils(), and
ProcessingEnvironment.getTypeUtils().| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractProcessor.Check<T extends Element>
Abstract
AbstractProcessor.Check base class. |
protected class |
AbstractProcessor.Criterion<T extends Element>
Abstract
AbstractProcessor.Criterion base class. |
| Modifier and Type | Field and Description |
|---|---|
protected Elements |
elements
|
protected Filer |
filer
|
protected JavaFileManager |
fm
JavacTask JavaFileManager instance. |
protected JavacTask |
javac
|
protected Trees |
trees
|
protected Types |
types
|
processingEnv| Constructor and Description |
|---|
AbstractProcessor() |
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasModifierSet, declaration, declaration, declaration, declaration, declaration, declaration, exceptions, getModifiers, getModifiers, modifiers, parameters, type, typeprotected JavaFileManager fm
JavacTask JavaFileManager instance.public AbstractProcessor()
public SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion in interface ProcessorgetSupportedSourceVersion in class AbstractProcessorpublic void init(ProcessingEnvironment processingEnv)
init in interface Processorinit in class AbstractProcessorpublic abstract boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process in interface Processorprocess in class AbstractProcessorprotected void whenAnnotationProcessingFinished()
TaskEvent.Kind.ANNOTATION_PROCESSING is
finished.protected ClassLoader getClassPathClassLoader(JavaFileManager fm)
fm - The JavaFileManager.ClassLoader.protected TypeElement asTypeElement(Class<?> type)
TypeElement for a Class.type - The Class.TypeElement for the Class.protected TypeMirror asTypeMirror(Class<?> type)
TypeMirror for a Class.type - The Class.TypeMirror for the Class.protected List<TypeMirror> asTypeMirrorList(Class<?>... types)
types - The array of Classes.List of TypeMirrors.protected ExecutableElement getConstructor(TypeElement type, List<TypeMirror> parameters)
type - The TypeElement.parameters - The constructor parameter types.ExecutableElement for the constructor.protected ExecutableElement getMethod(Method method)
ExecutableElement for a Method
prototype.method - The prototype Method.ExecutableElement for the method.protected ExecutableElement getMethod(TypeElement type, Method method)
ExecutableElement for a Method
prototype.type - The TypeElement.method - The prototype Method.ExecutableElement for the method.protected ExecutableElement overrides(ExecutableElement overrider)
overrider - The ExecutableElement.ExecutableElement if any;
null otherwise.Elements.overrides(ExecutableElement,ExecutableElement,TypeElement)protected boolean overrides(ExecutableElement overrider, ExecutableElement overridden)
overrider - The (possibly) overriding
ExecutableElement.overridden - The overridden ExecutableElement.true if overrider overrides
overridden; false otherwise.Elements.overrides(ExecutableElement,ExecutableElement,TypeElement)protected ExecutableElement implementationOf(ExecutableElement overridden, TypeElement type)
ExecutableElement
(Method) the argument
ExecutableElement is overriden by (if any).overridden - The ExecutableElement.type - The TypeElement.ExecutableElement if any;
null otherwise.overrides(ExecutableElement)protected ExecutableElement specifiedBy(ExecutableElement method)
ExecutableElement
(Method) the argument
ExecutableElement is specified by (if any).method - The ExecutableElement.ExecutableElement if any;
null otherwise.overrides(ExecutableElement)protected AnnotationMirror getAnnotationMirror(Element element, Class<? extends Annotation> type)
Element's AnnotationMirror.element - The annotated Element.type - The Annotation type (Class).AnnotationMirror if the Element is
annotated with the argument annotation; null
otherwise.Element.getAnnotationMirrors()protected AnnotationMirror getAnnotationMirror(Element element, TypeElement type)
Element's AnnotationMirror.element - The annotated Element.type - The Annotation type
(TypeElement).AnnotationMirror if the Element is
annotated with the argument annotation; null
otherwise.Element.getAnnotationMirrors()protected AnnotationValue getAnnotationValue(AnnotationMirror annotation, String name)
AnnotationMirror element's
AnnotationValue.annotation - The AnnotationMirror.name - The simple name of the element.AnnotationValue if it is defined; null
otherwise.Elements.getElementValuesWithDefaults(AnnotationMirror)protected boolean isEmptyArray(AnnotationValue value)
AnnotationValue is "empty":
null or an empty array.value - The AnnotationValue.true if empty; {code false} otherwise.protected String getPropertyName(ExecutableElement element)
ExecutableElement.element - The ExecutableElement.String if the ExecutableElement
is a getter or setter method; null otherwise.protected boolean isGetterMethod(ExecutableElement element)
ExecutableElement is a bean getter.element - The ExecutableElement.true if the Element has a non-private getter
method; false otherwise.protected Set<String> getPropertyNames(TypeElement type)
Set of bean property names for the
specified TypeElement.type - The TypeElement to analyze.Set of bean property names.protected Predicate<Element> hasSameSignatureAs(List<TypeMirror> parameters)
protected Predicate<Element> hasSameSignatureAs(Method method)
protected Predicate<Element> hasSameSignatureAs(CharSequence name, Class<?>[] parameters)
protected Predicate<Element> isAssignableTo(Class<?> type)
protected Predicate<Element> isAssignableTo(TypeMirror type)
protected Predicate<Element> isAssignableTo(Class<?> type, Function<? super Element,TypeMirror> extractor)
protected Predicate<Element> isAssignableTo(TypeMirror type, Function<? super Element,TypeMirror> extractor)
protected Predicate<Element> named(CharSequence name)
protected Predicate<Element> withParameters(Class<?>[] parameters)
protected Predicate<Element> withParameters(List<TypeMirror> parameters)
protected Predicate<Element> withModifiers(Modifier... modifiers)
protected Predicate<Element> withModifiers(Set<Modifier> modifiers)
protected Predicate<Element> withoutModifiers(Modifier... modifiers)
protected Predicate<Element> withoutModifiers(Set<Modifier> modifiers)
protected <E> Predicate<Element> without(Set<E> set, Function<Element,Collection<E>> extractor)
protected void print(Diagnostic.Kind kind, String format, Object... argv)
kind - The Diagnostic.Kind.format - The message format String.argv - Optional arguments to the message format
String.Messager.printMessage(Diagnostic.Kind,CharSequence)protected void print(Diagnostic.Kind kind, Element element, String format, Object... argv)
kind - The Diagnostic.Kind.element - The offending Element.format - The message format String.argv - Optional arguments to the message format
String.Messager.printMessage(Diagnostic.Kind,CharSequence,Element)protected void print(Diagnostic.Kind kind, Element element, AnnotationMirror annotation, String format, Object... argv)
kind - The Diagnostic.Kind.element - The offending Element.annotation - The offending AnnotationMirror.format - The message format String.argv - Optional arguments to the message format
String.Messager.printMessage(Diagnostic.Kind,CharSequence,Element,AnnotationMirror)protected void print(Diagnostic.Kind kind, Element element, AnnotationMirror annotation, AnnotationValue value, String format, Object... argv)
kind - The Diagnostic.Kind.element - The offending Element.annotation - The offending AnnotationMirror.value - The offending AnnotationValue.format - The message format String.argv - Optional arguments to the message format
String.Messager.printMessage(Diagnostic.Kind,CharSequence,Element,AnnotationMirror,AnnotationValue)protected void print(Diagnostic.Kind kind, Throwable throwable)
Throwable.kind - The Diagnostic.Kind.throwable - The Throwable.Copyright © 2015–2020 Allen D. Ball. All rights reserved.