@groovy.transform.CompileStatic class AstAnnotationUtils extends java.lang.Object
Utility methods for dealing with annotations in AST transforms
Constructor and description |
---|
AstAnnotationUtils() |
Type Params | Return Type | Name and description |
---|---|---|
|
static void |
addAnnotationIfNecessary(org.codehaus.groovy.ast.AnnotatedNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Adds an annotation to the give nclass node if it doesn't already exist |
|
static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.AnnotatedNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Adds an annotation to the given class node or returns the existing annotation |
|
static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.AnnotatedNode annotatedNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.util.Map<java.lang.String, java.lang.Object> members) Adds an annotation to the given class node or returns the existing annotation |
|
static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.AnnotatedNode annotatedNode, org.codehaus.groovy.ast.ClassNode annotationClassNode) |
|
static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.AnnotatedNode annotatedNode, org.codehaus.groovy.ast.ClassNode annotationClassNode, java.util.Map<java.lang.String, java.lang.Object> members) |
|
static org.codehaus.groovy.ast.AnnotationNode |
findAnnotation(org.codehaus.groovy.ast.AnnotatedNode classNode, java.lang.Class<?> type) |
|
static org.codehaus.groovy.ast.AnnotationNode |
findAnnotation(org.codehaus.groovy.ast.AnnotatedNode annotationClassNode, java.util.List<org.codehaus.groovy.ast.AnnotationNode> annotations) |
|
static boolean |
hasAnnotation(org.codehaus.groovy.ast.MethodNode methodNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Returns true if MethodNode is marked with annotationClass |
|
static boolean |
hasAnnotation(org.codehaus.groovy.ast.MethodNode methodNode, org.codehaus.groovy.ast.ClassNode annotationClassNode) |
|
static boolean |
hasAnnotation(org.codehaus.groovy.ast.MethodNode methodNode, java.lang.String annotationClassName) Returns true if MethodNode is marked with annotationClass |
|
static boolean |
hasAnnotation(java.util.List<org.codehaus.groovy.ast.AnnotationNode> annotationNodes, org.codehaus.groovy.ast.AnnotationNode annotationNode) |
|
static boolean |
hasAnnotation(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Returns true if classNode is marked with annotationClass |
|
static boolean |
hasAnyAnnotations(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation>[] annotationsToLookFor)
|
|
static boolean |
hasJunitAnnotation(org.codehaus.groovy.ast.MethodNode md) Whether the method node has any JUnit annotations |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Adds an annotation to the give nclass node if it doesn't already exist
classNode
- The class nodeannotationClass
- The annotation classAdds an annotation to the given class node or returns the existing annotation
classNode
- The class nodeannotationClass
- The annotation classAdds an annotation to the given class node or returns the existing annotation
annotatedNode
- The class nodeannotationClass
- The annotation classReturns true if MethodNode is marked with annotationClass
methodNode
- A MethodNode to inspectannotationClass
- an annotation to look forReturns true if MethodNode is marked with annotationClass
methodNode
- A MethodNode to inspectannotationClass
- an annotation to look forReturns true if classNode is marked with annotationClass
classNode
- A ClassNode to inspectannotationClass
- an annotation to look for
classNode
- a ClassNode to searchannotationsToLookFor
- Annotations to look forWhether the method node has any JUnit annotations
md
- The method node