public class YieldStatement
extends Statement
Represents a yield statement that produces the value of an enclosing
SwitchExpression. Unlike ReturnStatement, yield does
not return from the enclosing method; it completes the switch expression and
transfers the yielded value to the expression's join point (JEP 361).
| Constructor and description |
|---|
YieldStatement(Expression expression)Constructs a yield statement with the given result expression. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Expression |
getExpression()Returns the expression whose value becomes the switch-expression result. |
|
public String |
getText() |
|
public void |
setExpression(Expression expression)Sets the expression whose value becomes the switch-expression result. |
|
public String |
toString() |
|
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 yield statement with the given result expression.
expression - the value produced for the enclosing switch expressionReturns the expression whose value becomes the switch-expression result.
Sets the expression whose value becomes the switch-expression result.
expression - the yielded ExpressionCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.