com.github.javaparser.ast.stmt.SwitchStmt ,
but can also be used as an expression.
int a = switch(x) { case 5,6 -> 20; case 9 -> 30; default -> 40; };
int a = switch(x) { case 5,6: break 20; default: break 5+5; };
int a = switch(x) { case 5,6: yield 20; default: yield 5+5; };
SwitchEntry, com.github.javaparser.ast.stmt.SwitchStmt , SwitchNode, com.github.javaparser.ast.stmt.BreakStmt , com.github.javaparser.ast.stmt.YieldStmt
| Modifier and Type | Field and Description |
|---|---|
| private NodeList | |
| private Expression |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | SwitchExpr(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 | |
| SwitchExpr | back to summary |
|---|---|
| public SwitchExpr() | |
| SwitchExpr | back to summary |
|---|---|
public SwitchExpr(final Expression selector, final NodeList<SwitchEntry> entries)
| |
| SwitchExpr | back to summary |
|---|---|
| public SwitchExpr(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.
| |
| asSwitchExpr | back to summary |
|---|---|
| public SwitchExpr asSwitchExpr() Overrides com.
| |
| clone | back to summary |
|---|---|
| public SwitchExpr 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 SwitchExprMetaModel getMetaModel() Overrides com.
| |
| getSelector | back to summary |
|---|---|
| public Expression getSelector() Implements com.
| |
| ifSwitchExpr | back to summary |
|---|---|
| public void ifSwitchExpr(Consumer<SwitchExpr> action) Overrides com.
| |
| isSwitchExpr | back to summary |
|---|---|
| public boolean isSwitchExpr() 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 SwitchExpr setEntries(final NodeList<SwitchEntry> entries) Implements com.
| |
| setSelector | back to summary |
|---|---|
| public SwitchExpr setSelector(final Expression selector) Implements com.
| |
| toSwitchExpr | back to summary |
|---|---|
| public Optional Overrides com.
| |