blob: 3d785d282e56b8f8f2b9d3e63fda358926bdf507 (
plain)
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
42
43
|
package org.zwobble.couscous.ast;
import java.util.List;
import com.google.common.collect.ImmutableList;
import lombok.Singular;
import lombok.Value;
@Value
public class ClassNode {
public static ClassNode.Builder builder(String name) {
return new Builder(name);
}
public static class Builder {
private final String name;
private final ImmutableList.Builder<MethodNode> methods;
public Builder(String name) {
this.name = name;
this.methods = ImmutableList.builder();
}
public Builder method(MethodNode method) {
this.methods.add(method);
return this;
}
public ClassNode build() {
return new ClassNode(name, methods.build());
}
}
String name;
@Singular
List<MethodNode> methods;
public String getLocalName() {
// TODO Stronger notion of class names? Should look up the terminology
return name.substring(name.lastIndexOf(".") + 1);
}
}
|