Repository navigation
Expand file tree
/
Copy pathStringValue.java
More file actions
97 lines (73 loc) · 2.4 KB
/
Copy pathStringValue.java
File metadata and controls
97 lines (73 loc) · 2.4 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package graphql.language;
import graphql.PublicApi;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@PublicApi
public class StringValue extends AbstractNode<StringValue> implements Value<StringValue> {
private final String value;
private StringValue(String value, SourceLocation sourceLocation, List<Comment> comments) {
super(sourceLocation, comments);
this.value = value;
}
public String getValue() {
return value;
}
@Override
public List<Node> getChildren() {
List<Node> result = new ArrayList<>();
return result;
}
@Override
public String toString() {
return "StringValue{" +
"value='" + value + '\'' +
'}';
}
@Override
public boolean isEqualTo(Node o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StringValue that = (StringValue) o;
return !(value != null ? !value.equals(that.value) : that.value != null);
}
@Override
public StringValue deepCopy() {
return new StringValue(value, getSourceLocation(), getComments());
}
@Override
public TraversalControl accept(TraverserContext<Node> context, NodeVisitor visitor) {
return visitor.visitStringValue(this, context);
}
public static Builder newStringValue() {
return new Builder();
}
public static Builder newStringValue(String value) {
return new Builder().value(value);
}
public static final class Builder implements NodeBuilder {
private SourceLocation sourceLocation;
private String value;
private List<Comment> comments = Collections.emptyList();
private Builder() {
}
public Builder sourceLocation(SourceLocation sourceLocation) {
this.sourceLocation = sourceLocation;
return this;
}
public Builder value(String value) {
this.value = value;
return this;
}
public Builder comments(List<Comment> comments) {
this.comments = comments;
return this;
}
public StringValue build() {
StringValue stringValue = new StringValue(value, sourceLocation, comments);
return stringValue;
}
}
}