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.
| Constructor and description |
|---|
ThrowStatement(Expression expression)Constructs a throw statement with the given exception expression. |
| 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) |
| 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 |
Constructs a throw statement with the given exception expression.
expression - the Expression that evaluates to the exception to throwReturns the exception expression to be thrown.
Sets the exception expression to be thrown.
expression - the Expression that evaluates to an exception objectCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.