Tree
public interface CaseTree extends Tree
case
in a switch
statement or expression. For example: case expression : statements default : statements
Modifier and Type | Interface | Description |
---|---|---|
static enum |
CaseTree.CaseKind |
The syntactic form of this case: STATEMENT: case <expression>: <statements> RULE: case <expression> -> <expression>/<statement> |
Modifier and Type | Method | Description |
---|---|---|
default Tree |
getBody() |
For case with kind CaseTree.CaseKind.RULE, returns the statement or expression after the arrow. |
default CaseTree.CaseKind |
getCaseKind() |
Returns the kind of this case. |
ExpressionTree |
getExpression() |
Deprecated. |
List |
getExpressions() |
Returns the labels for this case. |
ExpressionTree |
getGuard() |
The guard for the case. |
List |
getLabels() |
Returns the labels for this case. |
List |
getStatements() |
For case with kind CaseTree.CaseKind.STATEMENT, returns the statements labeled by the case. |
@Deprecated ExpressionTree getExpression()
getExpressions()
.null
if this is the default case. If this case has multiple labels, returns the first label.List<? extends ExpressionTree> getExpressions()
List<? extends CaseLabelTree> getLabels()
default
case return a list with a single element, DefaultCaseLabelTree
.ExpressionTree getGuard()
List<? extends StatementTree> getStatements()
null
for case with kind CaseTree.CaseKind.RULE.default Tree getBody()
null
for case with kind CaseTree.CaseKind.STATEMENT.default CaseTree.CaseKind getCaseKind()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/tree/CaseTree.html
getExpressions()
.