Package org.apache.groovy.ast.tools
Class AnnotatedNodeUtils
java.lang.Object
org.apache.groovy.ast.tools.AnnotatedNodeUtils
Utility class for working with AnnotatedNodes
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleandeemedInternal(AnnotatedNode node) Checks whether an AST node is deemed internal, either by name convention (contains$) or by being annotated with@Internal.static booleanhasAnnotation(AnnotatedNode node, ClassNode annotation) Checks whether the supplied node carries the given annotation.static booleanisGenerated(AnnotatedNode node) Checks whether the supplied node has been marked as generated.static booleanisInternal(AnnotatedNode node) Checks whether a node is annotated with@Internal.static <T extends AnnotatedNode>
TmarkAsGenerated(ClassNode containingClass, T nodeToMark) Marks the supplied node with@Generatedwhen generation metadata is available.static <T extends AnnotatedNode>
TmarkAsGenerated(ClassNode containingClass, T nodeToMark, boolean skipChecks) Marks the supplied node with@Generated.static <T extends AnnotatedNode>
TmarkAsInternal(T nodeToMark) Marks a node with the@Internalannotation.
-
Method Details
-
markAsGenerated
Marks the supplied node with@Generatedwhen generation metadata is available.- Parameters:
containingClass- the class currently receiving generated membersnodeToMark- the node to annotate- Returns:
- the supplied node
-
markAsGenerated
public static <T extends AnnotatedNode> T markAsGenerated(ClassNode containingClass, T nodeToMark, boolean skipChecks) Marks the supplied node with@Generated.- Parameters:
containingClass- the class currently receiving generated membersnodeToMark- the node to annotateskipChecks- whether to skip the usual source-context checks- Returns:
- the supplied node
-
hasAnnotation
Checks whether the supplied node carries the given annotation.- Parameters:
node- the node to inspectannotation- the annotation type to look for- Returns:
trueif the node has at least one matching annotation
-
isGenerated
Checks whether the supplied node has been marked as generated.- Parameters:
node- the node to inspect- Returns:
trueif the node carries@Generated
-
markAsInternal
Marks a node with the@Internalannotation.- Since:
- 6.0.0
-
isInternal
Checks whether a node is annotated with@Internal.- Since:
- 6.0.0
-
deemedInternal
Checks whether an AST node is deemed internal, either by name convention (contains$) or by being annotated with@Internal.- Since:
- 6.0.0
-