public abstract class AstUtils extends java.lang.Object
General purpose AST utilities.
Type Params | Return Type | Name and description |
---|---|---|
|
public static org.codehaus.groovy.ast.expr.ClosureExpression |
getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, java.lang.String name, boolean remove) Extract a top-level name closure from inside this block if there is one,
optionally removing it from the block at the same time. |
|
public static org.codehaus.groovy.ast.expr.ClosureExpression |
getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, java.lang.String name) |
|
public static boolean |
hasAtLeastOneAnnotation(org.codehaus.groovy.ast.ClassNode node, java.lang.String annotations) Determine if a org.codehaus.groovy.ast.ClassNode has one or more of the specified annotations on the class or any of its methods. |
|
public static boolean |
hasAtLeastOneAnnotation(org.codehaus.groovy.ast.AnnotatedNode node, java.lang.String annotations) Determine if an org.codehaus.groovy.ast.AnnotatedNode has one or more of the specified annotations. |
|
public static boolean |
hasAtLeastOneFieldOrMethod(org.codehaus.groovy.ast.ClassNode node, java.lang.String types) Determine if a org.codehaus.groovy.ast.ClassNode has one or more fields of the specified types or method returning one or more of the specified types. |
|
public static boolean |
hasAtLeastOneInterface(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String types) |
|
public static boolean |
subclasses(org.codehaus.groovy.ast.ClassNode node, java.lang.String types) Determine if a org.codehaus.groovy.ast.ClassNode subclasses any of the specified types N.B. the type names are not normally fully qualified. |
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() |
Extract a top-level name
closure from inside this block if there is one,
optionally removing it from the block at the same time.
block
- a block statement (class definition)name
- the name to look forremove
- whether the extracted closure should be removedDetermine if a org.codehaus.groovy.ast.ClassNode has one or more of the specified annotations on the class or any of its methods. N.B. the type names are not normally fully qualified.
node
- the class to examineannotations
- the annotations to look fortrue
if at least one of the annotations is found, otherwise
false
Determine if an org.codehaus.groovy.ast.AnnotatedNode has one or more of the specified annotations. N.B. the annotation type names are not normally fully qualified.
node
- the node to examineannotations
- the annotations to look fortrue
if at least one of the annotations is found, otherwise
false
Determine if a org.codehaus.groovy.ast.ClassNode has one or more fields of the specified types or method returning one or more of the specified types. N.B. the type names are not normally fully qualified.
node
- the class to examinetypes
- the types to look fortrue
if at least one of the types is found, otherwise false
Determine if a org.codehaus.groovy.ast.ClassNode subclasses any of the specified types N.B. the type names are not normally fully qualified.
node
- the class to examinetypes
- the types that may have been sub-classedtrue
if the class subclasses any of the specified types, otherwise
false