MethodCallExpression (Groovy 5.0.6)

Package: org.codehaus.groovy.ast.expr

## [Java] Class MethodCallExpression

- org.codehaus.groovy.ast.expr.MethodCallExpression

- All Implemented Interfaces and Traits:
    MethodCall

      public class MethodCallExpression
      extends Expression
      implements MethodCall

  A method call on an object or class.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static Expression` | `NO_ARGUMENTS` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Expression` | `EMPTY_ARRAY`

  - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public TupleExpression` | `addExpression(Expression e)`
    `` | `public Expression` | `getArguments()`
    `` | `public List<Expression>` | `getExpressions()`
    `` | `public GenericsType[]` | `getGenericsTypes()`
    `` | `public Expression` | `getMethod()`
    `` | `public String` | `getMethodAsString()` This method returns the method name as String if it is no dynamic calculated method name, but a constant.
    `` | `public MethodNode` | `getMethodTarget()` Returns: the target as method node if set
    `` | `public Expression` | `getObjectExpression()`
    `` | `public ASTNode` | `getReceiver()`
    `` | `public String` | `getText()`
    `` | `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
    `` | `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
    `` | `public boolean` | `isSpreadSafe()`
    `` | `public boolean` | `isUsingGenerics()`
    `` | `public void` | `setArguments(Expression arguments)`
    `` | `public void` | `setGenericsTypes(GenericsType[] genericsTypes)`
    `` | `public void` | `setImplicitThis(boolean implicitThis)`
    `` | `public void` | `setMethod(Expression method)`
    `` | `public void` | `setMethodTarget(MethodNode mn)` Sets a method call target for a direct method call.
    `` | `public void` | `setObjectExpression(Expression objectExpression)`
    `` | `public void` | `setSafe(boolean safe)`
    `` | `public void` | `setSourcePosition(ASTNode node)`
    `` | `public void` | `setSpreadSafe(boolean value)`
    `` | `public String` | `toString()`
    `` | `public Expression` | `transformExpression(ExpressionTransformer transformer)`
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Expression` | `getType, setType, transformExpression, transformExpressions, transformExpressions`
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Field Detail

    - #### public static final Expression NO_ARGUMENTS

  - ### Constructor Detail

    - #### public MethodCallExpression(Expression objectExpression, String method, Expression arguments)

    - #### public MethodCallExpression(Expression objectExpression, Expression method, Expression arguments)

  - ### Method Detail

    - #### @Override
      public TupleExpression addExpression(Expression e)

    - #### @Override
      public Expression getArguments()

    - #### @Override
      public List<Expression> getExpressions()

    - #### public GenericsType[] getGenericsTypes()

    - #### public Expression getMethod()

    - #### @Override
      public String getMethodAsString()

      This method returns the method name as String if it is no dynamic calculated method name, but a constant.

    - #### public MethodNode getMethodTarget()

      Returns:
        the target as method node if set

    - #### public Expression getObjectExpression()

    - #### @Override
      public ASTNode getReceiver()

    - #### @Override
      public String getText()

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

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

    - #### public boolean isSpreadSafe()

    - #### public boolean isUsingGenerics()

    - #### public void setArguments(Expression arguments)

    - #### public void setGenericsTypes(GenericsType[] genericsTypes)

    - #### public void setImplicitThis(boolean implicitThis)

    - #### public void setMethod(Expression method)

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

    - #### public void setObjectExpression(Expression objectExpression)

    - #### public void setSafe(boolean safe)

    - #### @Override
      public void setSourcePosition(ASTNode node)

    - #### public void setSpreadSafe(boolean value)

    - #### @Override
      public String toString()

    - #### @Override
      public Expression transformExpression(ExpressionTransformer transformer)

    - #### @Override
      public void visit(GroovyCodeVisitor visitor)