Class AnnotatedElements
java.lang.Object
be.imgn.gaia.processing.AnnotatedElements
The elements a
Step gets in a round, by annotation, and by meta-annotation for the step's
meta-annotations; and the root elements of the round, if the step
processes them.
for (Element mapper : elements.annotatedWith("com.example.Mapper")) {
...
}
An element found by a meta-annotation is also listed under the annotation it is annotated with, the one whose type
has the meta-annotation: with @Qualifier @interface Primary, an element annotated with @Primary is in
both withAnnotationsAnnotatedWith("javax.inject.Qualifier") and annotatedWith("com.example.Primary").
-
Method Summary
Modifier and TypeMethodDescriptionall()Returns every annotated element, whatever its annotation, each once.annotatedWith(String qualifiedName) Returns the elements annotated with an annotation.Returns the annotations at least one element has: those of the step, and those found by its meta-annotations.booleanisEmpty()Returns whether there is no element.Returns the root elements of the round, annotated or not, if the step processes them: its top-level types, and the packages and modules itspackage-infoandmodule-infofiles declare.toString()withAnnotationsAnnotatedWith(String metaAnnotation) Returns the elements annotated with an annotation whose type is annotated with a meta-annotation of the step: withjavax.inject.Qualifier, the elements annotated with a qualifier, such as@Named("primary").
-
Method Details
-
annotatedWith
-
withAnnotationsAnnotatedWith
Returns the elements annotated with an annotation whose type is annotated with a meta-annotation of the step: withjavax.inject.Qualifier, the elements annotated with a qualifier, such as@Named("primary"). Only the meta-annotations of the annotation type itself count, as forProcessingContext.annotationsAnnotatedWith(Element, String), which reads those annotations.- Parameters:
metaAnnotation- the fully qualified name of the meta-annotation type, one ofStep.metaAnnotations()- Returns:
- the elements, by annotation and then in source order; empty if there is none, or if the step does not declare that meta-annotation
-
rootElements
Returns the root elements of the round, annotated or not, if the step processes them: its top-level types, and the packages and modules itspackage-infoandmodule-infofiles declare.- Returns:
- the root elements, in the order javac gives them; empty if the step does not process them
- Since:
- 0.1.2
-
all
Returns every annotated element, whatever its annotation, each once. The root elements are not among them, unless they are annotated.- Returns:
- the elements, by annotation and then in source order
-
annotations
-
isEmpty
public boolean isEmpty()Returns whether there is no element.- Returns:
trueif no element is annotated, and there is no root element
-
toString
-