public class SwitchEntry extends Node implements NodeWithStatements<SwitchEntry>
SwitchStmt
switch (i) {
case 1:
case 2:
System.out.println(444);
break;
default:
System.out.println(0);
}
This contains three SwitchEntrys.
case 1 -> 15*15;
case 2 -> { a++; b++; }
case 3 -> throw new Exception();
These are three new variants.
Expression in an ExpressionStmt
which is stored as the first and only statement in statements.
BlockStmt as the first and only statement in statements.
ThrowStmt as the first and only statement in statements.
case MONDAY, FRIDAY, SUNDAY -> 6;
Multiple case labels are now allowed.
case 16*16, 10+10 -> 6;
Many kinds of expressions are now allowed.SwitchStmt,
SwitchExpr| Modifier and Type | Class and Description |
|---|---|
static class |
SwitchEntry.Type |
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversalABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration, SYMBOL_RESOLVER_KEY| Constructor and Description |
|---|
SwitchEntry() |
SwitchEntry(NodeList<Expression> labels,
SwitchEntry.Type type,
NodeList<Statement> statements) |
SwitchEntry(TokenRange tokenRange,
NodeList<Expression> labels,
SwitchEntry.Type type,
NodeList<Statement> statements)
This constructor is used by the parser and is considered private.
|
| Modifier and Type | Method and Description |
|---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
SwitchEntry |
clone() |
NodeList<Expression> |
getLabels() |
SwitchEntryMetaModel |
getMetaModel() |
NodeList<Statement> |
getStatements() |
SwitchEntry.Type |
getType() |
boolean |
remove(Node node) |
boolean |
replace(Node node,
Node replacementNode) |
SwitchEntry |
setLabels(NodeList<Expression> labels)
Sets the label
|
SwitchEntry |
setStatements(NodeList<Statement> statements) |
SwitchEntry |
setType(SwitchEntry.Type type) |
addOrphanComment, containsData, customInitialization, equals, findAll, findAll, findCompilationUnit, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getDataKeys, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getSymbolResolver, getTokenRange, getToStringPrettyPrinterConfiguration, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, setToStringPrettyPrinterConfiguration, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walkfinalize, getClass, notify, notifyAll, wait, wait, waitaddAndGetStatement, addAndGetStatement, addAndGetStatement, addAndGetStatement, addStatement, addStatement, addStatement, addStatement, addStatement, copyStatements, copyStatements, getStatement, isEmpty, setStatementfindAncestor, findAncestorcontainsWithin, getBegin, getEndpublic SwitchEntry()
public SwitchEntry(NodeList<Expression> labels, SwitchEntry.Type type, NodeList<Statement> statements)
public SwitchEntry(TokenRange tokenRange, NodeList<Expression> labels, SwitchEntry.Type type, NodeList<Statement> statements)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitableaccept in interface VisitableR - the type of the return value of the visitorA - the type the user argument passed to the visitorv - the visitor implementationarg - the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitablepublic NodeList<Expression> getLabels()
public NodeList<Statement> getStatements()
getStatements in interface NodeWithStatements<SwitchEntry>public SwitchEntry setLabels(NodeList<Expression> labels)
labels - the label, can be nullpublic SwitchEntry setStatements(NodeList<Statement> statements)
setStatements in interface NodeWithStatements<SwitchEntry>public SwitchEntry clone()
public SwitchEntryMetaModel getMetaModel()
getMetaModel in class Nodepublic SwitchEntry.Type getType()
public SwitchEntry setType(SwitchEntry.Type type)
Copyright © 2007–2019. All rights reserved.