-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThrowStmt.java
More file actions
36 lines (28 loc) · 799 Bytes
/
Copy pathThrowStmt.java
File metadata and controls
36 lines (28 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package jtree.nodes;
import java.util.function.Consumer;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.NonNull;
@EqualsAndHashCode
@Getter @Setter
public class ThrowStmt extends Node implements Statement {
protected @NonNull Expression expression;
public ThrowStmt(Expression expression) {
setExpression(expression);
}
@Override
public ThrowStmt clone() {
return new ThrowStmt(getExpression().clone());
}
@Override
public String toCode() {
return "throw " + expression.toCode() + ";";
}
@Override
public <N extends INode> void accept(TreeVisitor visitor, Node parent, Consumer<N> replacer) {
if(visitor.visitThrowStmt(this, parent, cast(replacer))) {
getExpression().accept(visitor, this, this::setExpression);
}
}
}