public abstract class AstUtils extends Object
Constructor and Description |
---|
AstUtils() |
Modifier and Type | Method and Description |
---|---|
static org.codehaus.groovy.ast.expr.ClosureExpression |
getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block,
String name) |
static org.codehaus.groovy.ast.expr.ClosureExpression |
getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block,
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. |
static boolean |
hasAtLeastOneAnnotation(org.codehaus.groovy.ast.AnnotatedNode node,
String... annotations)
Determine if an
AnnotatedNode has one or more of the specified annotations. |
static boolean |
hasAtLeastOneAnnotation(org.codehaus.groovy.ast.ClassNode node,
String... annotations)
Determine if a
ClassNode has one or more of the specified annotations on
the class or any of its methods. |
static boolean |
hasAtLeastOneFieldOrMethod(org.codehaus.groovy.ast.ClassNode node,
String... types)
Determine if a
ClassNode has one or more fields of the specified types or
method returning one or more of the specified types. |
static boolean |
hasAtLeastOneInterface(org.codehaus.groovy.ast.ClassNode classNode,
String... types) |
static boolean |
subclasses(org.codehaus.groovy.ast.ClassNode node,
String... types)
Determine if a
ClassNode subclasses any of the specified types N.B. |
public static boolean hasAtLeastOneAnnotation(org.codehaus.groovy.ast.ClassNode node, String... annotations)
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
public static boolean hasAtLeastOneAnnotation(org.codehaus.groovy.ast.AnnotatedNode node, String... annotations)
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
public static boolean hasAtLeastOneFieldOrMethod(org.codehaus.groovy.ast.ClassNode node, String... types)
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
public static boolean subclasses(org.codehaus.groovy.ast.ClassNode node, String... types)
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
public static boolean hasAtLeastOneInterface(org.codehaus.groovy.ast.ClassNode classNode, String... types)
public static org.codehaus.groovy.ast.expr.ClosureExpression getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, String name, boolean remove)
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 or not the extracted closure should be removedpublic static org.codehaus.groovy.ast.expr.ClosureExpression getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, String name)
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.