Package org.codehaus.groovy.ast.expr
Class MethodCallExpression
- java.lang.Object
 - 
- org.codehaus.groovy.ast.ASTNode
 - 
- org.codehaus.groovy.ast.AnnotatedNode
 - 
- org.codehaus.groovy.ast.expr.Expression
 - 
- org.codehaus.groovy.ast.expr.MethodCallExpression
 
 
 
 
 
- 
- All Implemented Interfaces:
 GroovydocHolder<AnnotatedNode>,MethodCall,NodeMetaDataHandler
public class MethodCallExpression extends Expression implements MethodCall
A method call on an object or class. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static ExpressionNO_ARGUMENTS- 
Fields inherited from class org.codehaus.groovy.ast.expr.Expression
EMPTY_ARRAY 
- 
Fields inherited from interface groovy.lang.groovydoc.GroovydocHolder
DOC_COMMENT 
 - 
 
- 
Constructor Summary
Constructors Constructor Description MethodCallExpression(Expression objectExpression, String method, Expression arguments)MethodCallExpression(Expression objectExpression, Expression method, Expression arguments) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressiongetArguments()GenericsType[]getGenericsTypes()ExpressiongetMethod()StringgetMethodAsString()This method returns the method name as String if it is no dynamic calculated method name, but a constant.MethodNodegetMethodTarget()ExpressiongetObjectExpression()ASTNodegetReceiver()StringgetText()booleanisImplicitThis()booleanisSafe()booleanisSpreadSafe()booleanisUsingGenerics()voidsetArguments(Expression arguments)voidsetGenericsTypes(GenericsType[] genericsTypes)voidsetImplicitThis(boolean implicitThis)voidsetMethod(Expression method)voidsetMethodTarget(MethodNode mn)Sets a method call target for a direct method call.voidsetObjectExpression(Expression objectExpression)voidsetSafe(boolean safe)voidsetSourcePosition(ASTNode node)Sets the source position using another ASTNode.voidsetSpreadSafe(boolean value)StringtoString()ExpressiontransformExpression(ExpressionTransformer transformer)Return a copy of the expression calling the transformer on any nested expressionsvoidvisit(GroovyCodeVisitor visitor)- 
Methods inherited from class org.codehaus.groovy.ast.expr.Expression
getType, setType, transformExpressions, transformExpressions 
- 
Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode
addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic 
- 
Methods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, hashCode, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData 
 - 
 
 - 
 
- 
- 
Field Detail
- 
NO_ARGUMENTS
public static final Expression NO_ARGUMENTS
 
 - 
 
- 
Constructor Detail
- 
MethodCallExpression
public MethodCallExpression(Expression objectExpression, String method, Expression arguments)
 
- 
MethodCallExpression
public MethodCallExpression(Expression objectExpression, Expression method, Expression arguments)
 
 - 
 
- 
Method Detail
- 
visit
public void visit(GroovyCodeVisitor visitor)
 
- 
transformExpression
public Expression transformExpression(ExpressionTransformer transformer)
Description copied from class:ExpressionReturn a copy of the expression calling the transformer on any nested expressions- Specified by:
 transformExpressionin classExpression
 
- 
getArguments
public Expression getArguments()
- Specified by:
 getArgumentsin interfaceMethodCall
 
- 
setArguments
public void setArguments(Expression arguments)
 
- 
getMethod
public Expression getMethod()
 
- 
setMethod
public void setMethod(Expression method)
 
- 
getMethodAsString
public String getMethodAsString()
This method returns the method name as String if it is no dynamic calculated method name, but a constant.- Specified by:
 getMethodAsStringin interfaceMethodCall
 
- 
getObjectExpression
public Expression getObjectExpression()
 
- 
setObjectExpression
public void setObjectExpression(Expression objectExpression)
 
- 
getReceiver
public ASTNode getReceiver()
- Specified by:
 getReceiverin interfaceMethodCall
 
- 
getText
public String getText()
- Specified by:
 getTextin interfaceMethodCall- Overrides:
 getTextin classASTNode
 
- 
isSafe
public boolean isSafe()
- Returns:
 - is this a safe method call, i.e. if true then if the source object is null then this method call will return null rather than throwing a null pointer exception
 
 
- 
setSafe
public void setSafe(boolean safe)
 
- 
isSpreadSafe
public boolean isSpreadSafe()
 
- 
setSpreadSafe
public void setSpreadSafe(boolean value)
 
- 
isImplicitThis
public boolean isImplicitThis()
- Returns:
 - true if no object expression was specified otherwise if some expression was specified for the object on which to evaluate the method then return false
 
 
- 
setImplicitThis
public void setImplicitThis(boolean implicitThis)
 
- 
getGenericsTypes
public GenericsType[] getGenericsTypes()
 
- 
setGenericsTypes
public void setGenericsTypes(GenericsType[] genericsTypes)
 
- 
isUsingGenerics
public boolean isUsingGenerics()
 
- 
getMethodTarget
public MethodNode getMethodTarget()
- Returns:
 - the target as method node if set
 
 
- 
setMethodTarget
public void setMethodTarget(MethodNode mn)
Sets a method call target for a direct method call. WARNING: A method call made this way will run outside of the MOP!- Parameters:
 mn- the target as MethodNode, mn==null means no target
 
- 
setSourcePosition
public void setSourcePosition(ASTNode node)
Description copied from class:ASTNodeSets the source position using another ASTNode. The sourcePosition consists of a line/column pair for the start and a line/column pair for the end of the expression or statement- Overrides:
 setSourcePositionin classASTNode- Parameters:
 node- - the node used to configure the position information
 
 - 
 
 -