Class AstUtils
java.lang.Object
org.springframework.boot.cli.compiler.AstUtils
General purpose AST utilities.
- Since:
 - 1.0.0
 - Author:
 - Phillip Webb, Dave Syer, Greg Turnquist
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic org.codehaus.groovy.ast.expr.ClosureExpressiongetClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, String name) static org.codehaus.groovy.ast.expr.ClosureExpressiongetClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, String name, boolean remove) Extract a top-levelnameclosure from inside this block if there is one, optionally removing it from the block at the same time.static booleanhasAtLeastOneAnnotation(org.codehaus.groovy.ast.AnnotatedNode node, String... annotations) Determine if anAnnotatedNodehas one or more of the specified annotations.static booleanhasAtLeastOneAnnotation(org.codehaus.groovy.ast.ClassNode node, String... annotations) Determine if aClassNodehas one or more of the specified annotations on the class or any of its methods.static booleanhasAtLeastOneFieldOrMethod(org.codehaus.groovy.ast.ClassNode node, String... types) Determine if aClassNodehas one or more fields of the specified types or method returning one or more of the specified types.static booleanhasAtLeastOneInterface(org.codehaus.groovy.ast.ClassNode classNode, String... types) static booleansubclasses(org.codehaus.groovy.ast.ClassNode node, String... types) Determine if aClassNodesubclasses any of the specified types N.B. 
- 
Constructor Details
- 
AstUtils
public AstUtils() 
 - 
 - 
Method Details
- 
hasAtLeastOneAnnotation
public static boolean hasAtLeastOneAnnotation(org.codehaus.groovy.ast.ClassNode node, String... annotations) Determine if aClassNodehas 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.- Parameters:
 node- the class to examineannotations- the annotations to look for- Returns:
 trueif at least one of the annotations is found, otherwisefalse
 - 
hasAtLeastOneAnnotation
public static boolean hasAtLeastOneAnnotation(org.codehaus.groovy.ast.AnnotatedNode node, String... annotations) Determine if anAnnotatedNodehas one or more of the specified annotations. N.B. the annotation type names are not normally fully qualified.- Parameters:
 node- the node to examineannotations- the annotations to look for- Returns:
 trueif at least one of the annotations is found, otherwisefalse
 - 
hasAtLeastOneFieldOrMethod
public static boolean hasAtLeastOneFieldOrMethod(org.codehaus.groovy.ast.ClassNode node, String... types) Determine if aClassNodehas 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.- Parameters:
 node- the class to examinetypes- the types to look for- Returns:
 trueif at least one of the types is found, otherwisefalse
 - 
subclasses
Determine if aClassNodesubclasses any of the specified types N.B. the type names are not normally fully qualified.- Parameters:
 node- the class to examinetypes- the types that may have been sub-classed- Returns:
 trueif the class subclasses any of the specified types, otherwisefalse
 - 
hasAtLeastOneInterface
public static boolean hasAtLeastOneInterface(org.codehaus.groovy.ast.ClassNode classNode, String... types)  - 
getClosure
public static org.codehaus.groovy.ast.expr.ClosureExpression getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, String name, boolean remove) Extract a top-levelnameclosure from inside this block if there is one, optionally removing it from the block at the same time.- Parameters:
 block- a block statement (class definition)name- the name to look forremove- whether or not the extracted closure should be removed- Returns:
 - a beans Closure if one can be found, null otherwise
 
 - 
getClosure
public static org.codehaus.groovy.ast.expr.ClosureExpression getClosure(org.codehaus.groovy.ast.stmt.BlockStatement block, String name)  
 -