Package: org.codehaus.groovy.ast.stmt

## [Java] Class ExpressionStatement

- org.codehaus.groovy.ast.stmt.ExpressionStatement

-     public class ExpressionStatement
      extends Statement

  Represents an expression statement that executes an expression where the return value is ignored. An expression statement wraps an Expression for use as a statement in contexts where an expression must be treated as a statement (e.g., method calls, assignments, or other side-effect-producing expressions). The expression is evaluated and its result is discarded.

  See Also:
    Expression
    Statement
    ReturnStatement

- - ### Constructor Summary

    Constructors
    Constructor and description
    `ExpressionStatement(Expression expression)` Constructs an expression statement with the given expression.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Expression` | `getExpression()` Returns the expression executed by this statement.
    `` | `public String` | `getText()`
    `` | `public void` | `setExpression(Expression expression)` Sets the expression executed by this statement.
    `` | `public String` | `toString()`
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Statement` | `addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public ExpressionStatement(Expression expression)

      Constructs an expression statement with the given expression.

      throws:
        IllegalArgumentException if the expression is null
      Parameters:
        `expression` - the Expression to execute; must not be null

  - ### Method Detail

    - #### public Expression getExpression()

      Returns the expression executed by this statement.

      Returns:
        the Expression

    - #### public String getText()

    - #### public void setExpression(Expression expression)

      Sets the expression executed by this statement.

      Parameters:
        `expression` - the Expression

    - #### public String toString()

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