-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassLiteral.java
More file actions
41 lines (32 loc) · 833 Bytes
/
Copy pathClassLiteral.java
File metadata and controls
41 lines (32 loc) · 833 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
37
38
39
40
41
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 ClassLiteral extends Node implements Expression {
protected @NonNull Type type;
public ClassLiteral(Type type) {
setType(type);
}
@Override
public Precedence precedence() {
return Precedence.PRIMARY;
}
@Override
public ClassLiteral clone() {
return new ClassLiteral(getType().clone());
}
@Override
public String toCode() {
return getType().toCode() + ".class";
}
@Override
public <N extends INode> void accept(TreeVisitor visitor, Node parent, Consumer<N> replacer) {
if(visitor.visitClassLiteral(this, parent, cast(replacer))) {
getType().accept(visitor, this, this::setType);
}
}
}