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, com.github.javaparser.ast.expr.SwitchExpr
| Modifier and Type | Class and Description |
|---|---|
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| private NodeList | |
| private NodeList | |
| private SwitchEntry. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | SwitchEntry(final NodeList<Expression> labels, final SwitchEntry.
|
| public | SwitchEntry(TokenRange tokenRange, NodeList<Expression> labels, SwitchEntry.
This constructor is used by the parser and is considered private. |
| Modifier and Type | Method and Description |
|---|---|
| public <R, A> R | accept(final GenericVisitor<R, A>
the visitor implementation v, final A the argument passed to the visitor (of type A) arg)Implements com. |
| public <A> void | accept(final VoidVisitor<A>
the visitor implementation v, final A any value relevant for the visitor (of type A) arg)Implements com. |
| public SwitchEntry | |
| public NodeList | |
| public SwitchEntryMetaModel | |
| public NodeList | |
| public SwitchEntry. | |
| public boolean | |
| public boolean | |
| public SwitchEntry | Returns: this, the SwitchEntrythe label, can be null labels)Sets the label |
| public SwitchEntry | setStatements(final NodeList<Statement> statements)
Implements com. |
| public SwitchEntry |
| labels | back to summary |
|---|---|
| private NodeList<Expression> labels | |
| statements | back to summary |
|---|---|
| private NodeList<Statement> statements | |
| type | back to summary |
|---|---|
| private SwitchEntry. | |
| SwitchEntry | back to summary |
|---|---|
| public SwitchEntry() | |
| SwitchEntry | back to summary |
|---|---|
public SwitchEntry(final NodeList<Expression> labels, final SwitchEntry.
| |
| SwitchEntry | back to summary |
|---|---|
| public SwitchEntry(TokenRange tokenRange, NodeList<Expression> labels, SwitchEntry. 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.
| |
| clone | back to summary |
|---|---|
| public SwitchEntry clone() Overrides 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
| |
| getLabels | back to summary |
|---|---|
public NodeList
| |
| getMetaModel | back to summary |
|---|---|
| public SwitchEntryMetaModel getMetaModel() Overrides com.
| |
| getStatements | back to summary |
|---|---|
| public NodeList Implements com.
| |
| getType | back to summary |
|---|---|
public SwitchEntry.
| |
| remove | back to summary |
|---|---|
| public boolean remove(Node node) Overrides com.
| |
| replace | back to summary |
|---|---|
| public boolean replace(Node node, Node replacementNode) Overrides com.
| |
| setLabels | back to summary |
|---|---|
| public SwitchEntry setLabels(final NodeList<Expression> labels) Sets the label
| |
| setStatements | back to summary |
|---|---|
| public SwitchEntry setStatements(final NodeList<Statement> statements) Implements com.
| |
| setType | back to summary |
|---|---|
public SwitchEntry setType(final SwitchEntry.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final SwitchEntry. | |
| public static final SwitchEntry. | |
| public static final SwitchEntry. | |
| public static final SwitchEntry. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static SwitchEntry. | |
| public static SwitchEntry. |
| BLOCK | back to summary |
|---|---|
| public static final SwitchEntry. | |
| EXPRESSION | back to summary |
|---|---|
| public static final SwitchEntry. | |
| STATEMENT_GROUP | back to summary |
|---|---|
| public static final SwitchEntry. | |
| THROWS_STATEMENT | back to summary |
|---|---|
| public static final SwitchEntry. | |
| Type | back to summary |
|---|---|
| private Type() | |
| valueOf | back to summary |
|---|---|
| public static SwitchEntry. | |
| values | back to summary |
|---|---|
| public static SwitchEntry. | |