-
public interface RoundEnvironment
An annotation processing tool framework will provide an annotation processor with an object implementing this interface so that the processor can query for information about a round of annotation processing.- Since:
- 1.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
errorRaised()
Returnstrue
if an error was raised in the prior round of processing; returnsfalse
otherwise.java.util.Set<? extends Element>
getElementsAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> a)
Returns the elements annotated with the given annotation type.java.util.Set<? extends Element>
getElementsAnnotatedWith(TypeElement a)
Returns the elements annotated with the given annotation type.default java.util.Set<? extends Element>
getElementsAnnotatedWithAny(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> annotations)
Returns the elements annotated with one or more of the given annotation types.default java.util.Set<? extends Element>
getElementsAnnotatedWithAny(TypeElement... annotations)
Returns the elements annotated with one or more of the given annotation types.java.util.Set<? extends Element>
getRootElements()
Returns the root elements for annotation processing generated by the prior round.boolean
processingOver()
Returnstrue
if types generated by this round will not be subject to a subsequent round of annotation processing; returnsfalse
otherwise.
-
-
-
Method Detail
-
processingOver
boolean processingOver()
Returnstrue
if types generated by this round will not be subject to a subsequent round of annotation processing; returnsfalse
otherwise.- Returns:
true
if types generated by this round will not be subject to a subsequent round of annotation processing; returnsfalse
otherwise
-
errorRaised
boolean errorRaised()
Returnstrue
if an error was raised in the prior round of processing; returnsfalse
otherwise.- Returns:
true
if an error was raised in the prior round of processing; returnsfalse
otherwise
-
getRootElements
java.util.Set<? extends Element> getRootElements()
Returns the root elements for annotation processing generated by the prior round.- Returns:
- the root elements for annotation processing generated by the prior round, or an empty set if there were none
-
getElementsAnnotatedWith
java.util.Set<? extends Element> getElementsAnnotatedWith(TypeElement a)
Returns the elements annotated with the given annotation type. The annotation may appear directly or be inherited. Only package elements, module elements, and type elements included in this round of annotation processing, or declarations of members, constructors, parameters, type parameters, or record components declared within those, are returned. Included type elements are root types and any member types nested within them. Elements of a package are not considered included simply because apackage-info
file for that package was created. Likewise, elements of a module are not considered included simply because amodule-info
file for that module was created.- Parameters:
a
- annotation type being requested- Returns:
- the elements annotated with the given annotation type, or an empty set if there are none
- Throws:
java.lang.IllegalArgumentException
- if the argument does not represent an annotation type
-
getElementsAnnotatedWithAny
default java.util.Set<? extends Element> getElementsAnnotatedWithAny(TypeElement... annotations)
Returns the elements annotated with one or more of the given annotation types.- Parameters:
annotations
- annotation types being requested- Returns:
- the elements annotated with one or more of the given annotation types, or an empty set if there are none
- Throws:
java.lang.IllegalArgumentException
- if the any elements of the argument set do not represent an annotation type- Since:
- 9
-
getElementsAnnotatedWith
java.util.Set<? extends Element> getElementsAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> a)
Returns the elements annotated with the given annotation type. The annotation may appear directly or be inherited. Only package elements, module elements, and type elements included in this round of annotation processing, or declarations of members, constructors, parameters, type parameters, or record components declared within those, are returned. Included type elements are root types and any member types nested within them. Elements in a package are not considered included simply because apackage-info
file for that package was created. Likewise, elements of a module are not considered included simply because amodule-info
file for that module was created.Note: An implementation of this method typically performs an internal conversion from the runtime reflective representation of an annotation type as a
Class
object to a different representation used for annotation processing. The set of annotation types present in the runtime context may differ from the set of annotation types present in the context of annotation processing in a particular environmental configuration. If an runtime annotation type is not present in the annotation processing context, the situation is not treated as an error and no elements are found for that annotation type.- Parameters:
a
- annotation type being requested- Returns:
- the elements annotated with the given annotation type, or an empty set if there are none
- Throws:
java.lang.IllegalArgumentException
- if the argument does not represent an annotation type- See Also:
AnnotatedConstruct.getAnnotation(Class)
,AnnotatedConstruct.getAnnotationsByType(Class)
-
getElementsAnnotatedWithAny
default java.util.Set<? extends Element> getElementsAnnotatedWithAny(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> annotations)
Returns the elements annotated with one or more of the given annotation types.Note: An implementation of this method typically performs an internal conversion from the runtime reflective representation of an annotation type as a
Class
object to a different representation used for annotation processing. The set of annotation types present in the runtime context may differ from the set of annotation types present in the context of annotation processing in a particular environmental configuration. If an runtime annotation type is not present in the annotation processing context, the situation is not treated as an error and no elements are found for that annotation type.- Parameters:
annotations
- annotation types being requested- Returns:
- the elements annotated with one or more of the given annotation types, or an empty set if there are none
- Throws:
java.lang.IllegalArgumentException
- if the any elements of the argument set do not represent an annotation type- Since:
- 9
- See Also:
AnnotatedConstruct.getAnnotation(Class)
,AnnotatedConstruct.getAnnotationsByType(Class)
-
-