|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gmetrics.util.AstUtil
public 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,
java.lang.String name)
Return the AnnotationNode for the named annotation, or else null. |
groovy.lang.MetaClass |
getMetaClass()
|
static java.util.List |
getMethodArguments(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall)
Return the List of Arguments for the specified MethodCallExpression. |
java.lang.Object |
getProperty(java.lang.String name)
|
static java.util.List |
getVariableExpressions(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression)
Return the List of VariableExpression objects referenced by the specified DeclarationExpression. |
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args)
|
static boolean |
isBlock(org.codehaus.groovy.ast.stmt.Statement statement)
Return true if the Statement is a block |
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 |
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)
|
static boolean |
isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall,
java.lang.String methodObject,
java.lang.String methodName)
Return true only if the MethodCallExpression represents a method call for the specified method object (receiver) and method name. |
static boolean |
isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall,
java.lang.String methodObject,
java.lang.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.stmt.Statement stmt,
java.lang.String methodObject,
java.lang.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 |
isMethodNamed(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall,
java.lang.String methodName)
Return true only if the MethodCallExpression represents a method call for the specified method name |
void |
setMetaClass(groovy.lang.MetaClass metaClass)
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isBlock(org.codehaus.groovy.ast.stmt.Statement statement)
statement - - the Statement to check
public static boolean isEmptyBlock(org.codehaus.groovy.ast.stmt.Statement statement)
statement - - the Statement to check
public static java.util.List getMethodArguments(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall)
methodCall - - the AST MethodCallExpression
public static boolean isMethodCall(org.codehaus.groovy.ast.stmt.Statement stmt,
java.lang.String methodObject,
java.lang.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
public static boolean isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall,
java.lang.String methodObject,
java.lang.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
public static boolean isMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall,
java.lang.String methodObject,
java.lang.String methodName)
methodCall - - the AST MethodCallExpressionmethodObject - - the name of the method object (receiver)methodName - - the name of the method being called
public static boolean isMethodNamed(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall,
java.lang.String methodName)
methodCall - - the AST MethodCallExpressionmethodName - - the expected name of the method being called
public static org.codehaus.groovy.ast.AnnotationNode getAnnotation(org.codehaus.groovy.ast.AnnotatedNode node,
java.lang.String name)
node - - the AnnotatedNodename - - the name of the annotation
public static java.util.List getVariableExpressions(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression)
declarationExpression - - the DeclarationExpression
public static boolean isFinalVariable(org.codehaus.groovy.ast.expr.DeclarationExpression declarationExpression,
SourceCode sourceCode)
public static boolean isFromGeneratedSourceCode(org.codehaus.groovy.ast.ASTNode node)
public groovy.lang.MetaClass getMetaClass()
getMetaClass in interface groovy.lang.GroovyObjectpublic void setMetaClass(groovy.lang.MetaClass metaClass)
setMetaClass in interface groovy.lang.GroovyObject
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.Object args)
invokeMethod in interface groovy.lang.GroovyObjectpublic java.lang.Object getProperty(java.lang.String name)
getProperty in interface groovy.lang.GroovyObject
public void setProperty(java.lang.String name,
java.lang.Object value)
setProperty in interface groovy.lang.GroovyObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||