switch(x) { case 5: case 6: a=100; break; case 9: a=33; break; default: throw new IllegalStateException(); };
switch(a) { ... } the selector is "a",
and the contents of the { ... } are the entries.
com.github.javaparser.ast.expr.SwitchExpr )
com.github.javaparser.ast.expr.SwitchExpr )
switch(x) { case BANANA,PEAR: b=10; break; default: b=5; };
switch(x) { case 5,6 -> println("uhuh"); default -> println("nope"); };
SwitchEntry, com.github.javaparser.ast.expr.SwitchExpr , SwitchNode, BreakStmt, YieldStmt
| Modifier and Type | Field and Description |
|---|---|
| private NodeList | |
| private Expression |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | SwitchStmt(TokenRange tokenRange, Expression selector, NodeList<SwitchEntry> entries)
This constructor is used by the parser and is considered private. |
| entries | back to summary |
|---|---|
| private NodeList<SwitchEntry> entries | |
| selector | back to summary |
|---|---|
| private Expression selector | |
| SwitchStmt | back to summary |
|---|---|
| public SwitchStmt() | |
| SwitchStmt | back to summary |
|---|---|
public SwitchStmt(final Expression selector, final NodeList<SwitchEntry> entries)
| |
| SwitchStmt | back to summary |
|---|---|
| public SwitchStmt(TokenRange tokenRange, Expression selector, NodeList<SwitchEntry> entries) This constructor is used by the parser and is considered private.
| |
| accept | back to summary |
|---|---|
| public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) Implements com. Doc from com. Accept method for visitor support.
| |
| accept | back to summary |
|---|---|
| public <A> void accept(final VoidVisitor<A> v, final A arg) Implements com. Doc from com. Accept method for visitor support.
| |
| asSwitchStmt | back to summary |
|---|---|
| public SwitchStmt asSwitchStmt() Overrides com.
| |
| clone | back to summary |
|---|---|
| public SwitchStmt clone() Overrides com. Implements com. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| getEntries | back to summary |
|---|---|
| public NodeList Implements com.
| |
| getEntry | back to summary |
|---|---|
| public SwitchEntry getEntry(int i) Implements com. | |
| getMetaModel | back to summary |
|---|---|
| public SwitchStmtMetaModel getMetaModel() Overrides com.
| |
| getSelector | back to summary |
|---|---|
| public Expression getSelector() Implements com.
| |
| ifSwitchStmt | back to summary |
|---|---|
| public void ifSwitchStmt(Consumer<SwitchStmt> action) Overrides com.
| |
| isSwitchStmt | back to summary |
|---|---|
| public boolean isSwitchStmt() Overrides com.
| |
| remove | back to summary |
|---|---|
| public boolean remove(Node node) Overrides com. Implements com.
| |
| replace | back to summary |
|---|---|
| public boolean replace(Node node, Node replacementNode) Overrides com. Implements com.
| |
| setEntries | back to summary |
|---|---|
| public SwitchStmt setEntries(final NodeList<SwitchEntry> entries) Implements com.
| |
| setSelector | back to summary |
|---|---|
| public SwitchStmt setSelector(final Expression selector) Implements com.
| |
| toSwitchStmt | back to summary |
|---|---|
| public Optional Overrides com.
| |