Package: org.codehaus.groovy.ast.stmt

## [Java] Class ThrowStatement

- org.codehaus.groovy.ast.stmt.ThrowStatement

-     public class ThrowStatement
      extends Statement

  Represents a throw statement that raises an exception. A throw statement evaluates an exception expression and throws the resulting exception object to interrupt normal execution flow and transfer control to an appropriate exception handler.

  See Also:
    CatchStatement
    TryCatchStatement
    Statement

- - ### Constructor Summary

    Constructors
    Constructor and description
    `ThrowStatement(Expression expression)` Constructs a throw statement with the given exception expression.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Expression` | `getExpression()` Returns the exception expression to be thrown.
    `` | `public String` | `getText()`
    `` | `public void` | `setExpression(Expression expression)` Sets the exception expression to be thrown.
    `` | `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 ThrowStatement(Expression expression)

      Constructs a throw statement with the given exception expression.

      Parameters:
        `expression` - the Expression that evaluates to the exception to throw

  - ### Method Detail

    - #### public Expression getExpression()

      Returns the exception expression to be thrown.

      Returns:
        the Expression that evaluates to an exception object

    - #### public String getText()

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

      Sets the exception expression to be thrown.

      Parameters:
        `expression` - the Expression that evaluates to an exception object

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