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:
    MethodCall

      public class MethodCallExpression
      extends Expression
      implements MethodCall

  A method call on an object or class
  Version:
    $Revision$
  Author:
    James Strachan

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Expression` | `NO_ARGUMENTS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodCallExpression(Expression objectExpression, Expression method, Expression arguments)`
    `MethodCallExpression(Expression objectExpression, String method, Expression arguments)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `getArguments()`
    `GenericsType[]` | `getGenericsTypes()`
    `Expression` | `getMethod()`
    `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()`
    `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` | `setSpreadSafe(boolean value)`
    `String` | `toString()`
    `Expression` | `transformExpression(ExpressionTransformer transformer)` Return a copy of the expression calling the transformer on any nested expressions
    `void` | `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, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

    - ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

      `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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)

      Overrides:
        `visit` in class `ASTNode`

    - #### transformExpression

          public Expression transformExpression(ExpressionTransformer transformer)

      Description copied from class: `Expression`
      Return a copy of the expression calling the transformer on any nested expressions
      Specified by:
        `transformExpression` in class `Expression`

    - #### getArguments

          public Expression getArguments()

      Specified by:
        `getArguments` in interface `MethodCall`

    - #### setArguments

          public void setArguments(Expression arguments)

    - #### getMethod

          public Expression getMethod()

    - #### setMethod

          public void setMethod(Expression method)

    - #### getReceiver

          public ASTNode getReceiver()

      Specified by:
        `getReceiver` in interface `MethodCall`

    - #### 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:
        `getMethodAsString` in interface `MethodCall`

    - #### setObjectExpression

          public void setObjectExpression(Expression objectExpression)

    - #### getObjectExpression

          public Expression getObjectExpression()

    - #### getText

          public String getText()

      Specified by:
        `getText` in interface `MethodCall`
      Overrides:
        `getText` in class `ASTNode`

    - #### 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)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getGenericsTypes

          public GenericsType[] getGenericsTypes()

    - #### setGenericsTypes

          public void setGenericsTypes(GenericsType[] genericsTypes)

    - #### isUsingGenerics

          public boolean isUsingGenerics()

    - #### 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

    - #### getMethodTarget

          public MethodNode getMethodTarget()

      Returns:
        the target as method node if set