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 Expression
NO_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, java.lang.String method, Expression arguments)
MethodCallExpression(Expression objectExpression, Expression method, Expression arguments)
-
Method Summary
Modifier and Type Method Description Expression
getArguments()
GenericsType[]
getGenericsTypes()
Expression
getMethod()
java.lang.String
getMethodAsString()
This method returns the method name as String if it is no dynamic calculated method name, but a constant.MethodNode
getMethodTarget()
Expression
getObjectExpression()
ASTNode
getReceiver()
java.lang.String
getText()
boolean
isImplicitThis()
boolean
isSafe()
boolean
isSpreadSafe()
boolean
isUsingGenerics()
void
setArguments(Expression arguments)
void
setGenericsTypes(GenericsType[] genericsTypes)
void
setImplicitThis(boolean implicitThis)
void
setMethod(Expression method)
void
setMethodTarget(MethodNode mn)
Sets a method call target for a direct method call.void
setObjectExpression(Expression objectExpression)
void
setSafe(boolean safe)
void
setSourcePosition(ASTNode node)
Sets the source position using another ASTNode.void
setSpreadSafe(boolean value)
java.lang.String
toString()
Expression
transformExpression(ExpressionTransformer transformer)
Return a copy of the expression calling the transformer on any nested expressionsvoid
visit(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, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Field Details
-
NO_ARGUMENTS
-
-
Constructor Details
-
MethodCallExpression
public MethodCallExpression(Expression objectExpression, java.lang.String method, Expression arguments) -
MethodCallExpression
-
-
Method Details
-
visit
-
transformExpression
Description copied from class:Expression
Return a copy of the expression calling the transformer on any nested expressions- Specified by:
transformExpression
in classExpression
-
getArguments
- Specified by:
getArguments
in interfaceMethodCall
-
setArguments
-
getMethod
-
setMethod
-
getMethodAsString
public java.lang.String getMethodAsString()This method returns the method name as String if it is no dynamic calculated method name, but a constant.- Specified by:
getMethodAsString
in interfaceMethodCall
-
getObjectExpression
-
setObjectExpression
-
getReceiver
- Specified by:
getReceiver
in interfaceMethodCall
-
getText
public java.lang.String getText()- Specified by:
getText
in interfaceMethodCall
- Overrides:
getText
in 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
-
setGenericsTypes
-
isUsingGenerics
public boolean isUsingGenerics() -
getMethodTarget
- Returns:
- the target as method node if set
-
setMethodTarget
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
Description copied from class:ASTNode
Sets 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:
setSourcePosition
in classASTNode
- Parameters:
node
- - the node used to configure the position information
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-