|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gmetrics.util.AstUtil
class AstUtil
Contains static utility methods related to Groovy AST.
This is an internal class and its API is subject to change.Method Summary | |
---|---|
static org.codehaus.groovy.ast.AnnotationNode
|
getAnnotation(org.codehaus.groovy.ast.AnnotatedNode node, String name)
Return the AnnotationNode for the named annotation, or else null. |
static List
|
getMethodArguments(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall)
Return the List of Arguments for the specified MethodCallExpression. |
static List
|
getVariableExpressions(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression)
Return the List of VariableExpression objects referenced by the specified DeclarationExpression. |
static boolean
|
isBlock(org.codehaus.groovy.ast.stmt.Statement statement)
Return true if the Statement is a block |
static boolean
|
isClosureField(org.codehaus.groovy.ast.FieldNode fieldNode)
Return true only if the specified FieldNode has an initial expression that is a Closure |
static boolean
|
isEmptyBlock(org.codehaus.groovy.ast.stmt.Statement statement)
Return true if the Statement is a block and it is empty (contains no "meaningful" statements). |
static boolean
|
isEmptyMethod(org.codehaus.groovy.ast.MethodNode methodNode)
|
static boolean
|
isFinalVariable(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression, SourceCode sourceCode)
Return true if the DeclarationExpression represents a 'final' variable declaration. |
static boolean
|
isFromGeneratedSourceCode(org.codehaus.groovy.ast.ASTNode node)
@return true if the ASTNode was generated (synthetic) rather than from the "real" input source code. |
static boolean
|
isMethodCall(org.codehaus.groovy.ast.stmt.Statement stmt, String methodObject, String methodName, int numArguments)
Return true only if the Statement represents a method call for the specified method object (receiver), method name, and with the specified number of arguments. |
static boolean
|
isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodObject, String methodName, int numArguments)
Return true only if the MethodCallExpression represents a method call for the specified method object (receiver), method name, and with the specified number of arguments. |
static boolean
|
isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodObject, String methodName)
Return true only if the MethodCallExpression represents a method call for the specified method object (receiver) and method name. |
static boolean
|
isMethodNamed(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName)
Return true only if the MethodCallExpression represents a method call for the specified method name |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Method Detail |
---|
static org.codehaus.groovy.ast.AnnotationNode getAnnotation(org.codehaus.groovy.ast.AnnotatedNode node, String name)
node
- - the AnnotatedNodename
- - the name of the annotation
static List getMethodArguments(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall)
methodCall
- - the AST MethodCallExpression
static List getVariableExpressions(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression)
declarationExpression
- - the DeclarationExpression
static boolean isBlock(org.codehaus.groovy.ast.stmt.Statement statement)
statement
- - the Statement to check
static boolean isClosureField(org.codehaus.groovy.ast.FieldNode fieldNode)
fieldNode
- - the FieldNode
static boolean isEmptyBlock(org.codehaus.groovy.ast.stmt.Statement statement)
statement
- - the Statement to check
static boolean isEmptyMethod(org.codehaus.groovy.ast.MethodNode methodNode)
static boolean isFinalVariable(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression, SourceCode sourceCode)
static boolean isFromGeneratedSourceCode(org.codehaus.groovy.ast.ASTNode node)
static boolean isMethodCall(org.codehaus.groovy.ast.stmt.Statement stmt, String methodObject, String methodName, int numArguments)
stmt
- - the AST StatementmethodObject
- - the name of the method object (receiver)methodName
- - the name of the method being callednumArguments
- - the number of arguments passed into the method
static boolean isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodObject, String methodName, int numArguments)
methodCall
- - the AST MethodCallExpressionmethodObject
- - the name of the method object (receiver)methodName
- - the name of the method being callednumArguments
- - the number of arguments passed into the method
static boolean isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodObject, String methodName)
methodCall
- - the AST MethodCallExpressionmethodObject
- - the name of the method object (receiver)methodName
- - the name of the method being called
static boolean isMethodNamed(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName)
methodCall
- - the AST MethodCallExpressionmethodName
- - the expected name of the method being called
Groovy Documentation