RoundEnvironment (Java SE 10 & JDK 10 ) (original) (raw)
public interface RoundEnvironment
Since:
1.6
Method Summary
All Methods Instance Methods Abstract Methods Default Methods
Modifier and Type Method Description boolean errorRaised() Returns true if an error was raised in the prior round of processing; returns false otherwise. Set<? extends Element> getElementsAnnotatedWith(Class<? extends Annotation> a) Returns the elements annotated with the given annotation type. Set<? extends Element> getElementsAnnotatedWith(TypeElement a) Returns the elements annotated with the given annotation type. default Set<? extends Element> getElementsAnnotatedWithAny(Set<Class<? extends Annotation>> annotations) Returns the elements annotated with one or more of the given annotation types. default Set<? extends Element> getElementsAnnotatedWithAny(TypeElement... annotations) Returns the elements annotated with one or more of the given annotation types. Set<? extends Element> getRootElements() Returns the root elements for annotation processing generated by the prior round. boolean processingOver() Returns true if types generated by this round will not be subject to a subsequent round of annotation processing; returns false otherwise. Method Detail
* #### processingOver boolean processingOver() Returns `true` if types generated by this round will not be subject to a subsequent round of annotation processing; returns `false` otherwise. Returns: `true` if types generated by this round will not be subject to a subsequent round of annotation processing; returns `false` otherwise * #### errorRaised boolean errorRaised() Returns `true` if an error was raised in the prior round of processing; returns `false` otherwise. Returns: `true` if an error was raised in the prior round of processing; returns `false` otherwise * #### getRootElements [Set](../../../java/util/Set.html "interface in java.util")<? extends [Element](../../../javax/lang/model/element/Element.html "interface in javax.lang.model.element")> getRootElements() Returns the [root elements](../../../javax/annotation/processing/Processor.html "interface in javax.annotation.processing") 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 [Set](../../../java/util/Set.html "interface in java.util")<? extends [Element](../../../javax/lang/model/element/Element.html "interface in javax.lang.model.element")> getElementsAnnotatedWith([TypeElement](../../../javax/lang/model/element/TypeElement.html "interface in javax.lang.model.element") 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, or type parameters declared within those, are returned. Included type elements are [root types](../../../javax/annotation/processing/RoundEnvironment.html#getRootElements%28%29) and any member types nested within them. Elements of a package are not considered included simply because a `package-info` file for that package was created. Likewise, elements of a module are not considered included simply because a `module-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: `[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if the argument does not represent an annotation type * #### getElementsAnnotatedWithAny default [Set](../../../java/util/Set.html "interface in java.util")<? extends [Element](../../../javax/lang/model/element/Element.html "interface in javax.lang.model.element")> getElementsAnnotatedWithAny([TypeElement](../../../javax/lang/model/element/TypeElement.html "interface in javax.lang.model.element")... annotations) Returns the elements annotated with one or more of the given annotation types. API Note: This method may be useful when processing repeating annotations by looking for an annotation type and its containing annotation type at the same time. Implementation Requirements: The default implementation of this method creates an empty result set, iterates over the annotations in the argument array calling [getElementsAnnotatedWith(TypeElement)](../../../javax/annotation/processing/RoundEnvironment.html#getElementsAnnotatedWith%28javax.lang.model.element.TypeElement%29) on each annotation and adding those results to the result set. Finally, the contents of the result set are returned as an unmodifiable set. 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: `[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if the any elements of the argument set do not represent an annotation type Since: 9 See The Java™ Language Specification: 9.6.3 Repeatable Annotation Types * #### getElementsAnnotatedWith [Set](../../../java/util/Set.html "interface in java.util")<? extends [Element](../../../javax/lang/model/element/Element.html "interface in javax.lang.model.element")> getElementsAnnotatedWith([Class](../../../java/lang/Class.html "class in java.lang")<? extends [Annotation](../../../java/lang/annotation/Annotation.html "interface in java.lang.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, or type parameters declared within those, are returned. Included type elements are [root types](../../../javax/annotation/processing/RoundEnvironment.html#getRootElements%28%29) and any member types nested within them. Elements in a package are not considered included simply because a `package-info` file for that package was created. Likewise, elements of a module are not considered included simply because a `module-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: `[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if the argument does not represent an annotation type * #### getElementsAnnotatedWithAny default [Set](../../../java/util/Set.html "interface in java.util")<? extends [Element](../../../javax/lang/model/element/Element.html "interface in javax.lang.model.element")> getElementsAnnotatedWithAny([Set](../../../java/util/Set.html "interface in java.util")<[Class](../../../java/lang/Class.html "class in java.lang")<? extends [Annotation](../../../java/lang/annotation/Annotation.html "interface in java.lang.annotation")>> annotations) Returns the elements annotated with one or more of the given annotation types. API Note: This method may be useful when processing repeating annotations by looking for an annotation type and its containing annotation type at the same time. Implementation Requirements: The default implementation of this method creates an empty result set, iterates over the annotations in the argument set calling [getElementsAnnotatedWith(Class)](../../../javax/annotation/processing/RoundEnvironment.html#getElementsAnnotatedWith%28java.lang.Class%29) on each annotation and adding those results to the result set. Finally, the contents of the result set are returned as an unmodifiable set. 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: `[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if the any elements of the argument set do not represent an annotation type Since: 9 See The Java™ Language Specification: 9.6.3 Repeatable Annotation Types
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.