forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputValueDefinition.java
More file actions
174 lines (139 loc) · 4.67 KB
/
Copy pathInputValueDefinition.java
File metadata and controls
174 lines (139 loc) · 4.67 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package graphql.language;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class InputValueDefinition extends AbstractNode<InputValueDefinition> implements DirectivesContainer<InputValueDefinition> {
private final String name;
private Type type;
private Value defaultValue;
private Description description;
private final List<Directive> directives;
public InputValueDefinition(String name) {
this(name, null, null, new ArrayList<>());
}
public InputValueDefinition(String name, Type type) {
this(name, type, null, new ArrayList<>());
}
public InputValueDefinition(String name, Type type, Value defaultValue) {
this(name, type, defaultValue, new ArrayList<>());
}
public InputValueDefinition(String name, Type type, Value defaultValue, List<Directive> directives) {
this.name = name;
this.type = type;
this.defaultValue = defaultValue;
this.directives = directives;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
@Override
public String getName() {
return name;
}
public Description getDescription() {
return description;
}
public void setDescription(Description description) {
this.description = description;
}
public Value getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(Value defaultValue) {
this.defaultValue = defaultValue;
}
@Override
public List<Directive> getDirectives() {
return directives;
}
@Override
public List<Node> getChildren() {
List<Node> result = new ArrayList<>();
result.add(type);
result.add(defaultValue);
result.addAll(directives);
return result;
}
@Override
public boolean isEqualTo(Node o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InputValueDefinition that = (InputValueDefinition) o;
return NodeUtil.isEqualTo(this.name, that.name);
}
@Override
public InputValueDefinition deepCopy() {
return new InputValueDefinition(name,
deepCopy(type),
deepCopy(defaultValue),
deepCopy(directives)
);
}
@Override
public String toString() {
return "InputValueDefinition{" +
"name='" + name + '\'' +
", type=" + type +
", defaultValue=" + defaultValue +
", directives=" + directives +
'}';
}
@Override
public TraversalControl accept(TraverserContext<Node> context, NodeVisitor visitor) {
return visitor.visitInputValueDefinition(this, context);
}
public static Builder newInputValueDefinition() {
return new Builder();
}
public static final class Builder implements NodeBuilder {
private SourceLocation sourceLocation;
private List<Comment> comments = Collections.emptyList();
private String name;
private Type type;
private Value defaultValue;
private Description description;
private List<Directive> directives;
private Builder() {
}
public Builder sourceLocation(SourceLocation sourceLocation) {
this.sourceLocation = sourceLocation;
return this;
}
public Builder comments(List<Comment> comments) {
this.comments = comments;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public Builder type(Type type) {
this.type = type;
return this;
}
public Builder defaultValue(Value defaultValue) {
this.defaultValue = defaultValue;
return this;
}
public Builder description(Description description) {
this.description = description;
return this;
}
public Builder directives(List<Directive> directives) {
this.directives = directives;
return this;
}
public InputValueDefinition build() {
InputValueDefinition inputValueDefinition = new InputValueDefinition(name, type, defaultValue, directives);
inputValueDefinition.setSourceLocation(sourceLocation);
inputValueDefinition.setComments(comments);
inputValueDefinition.setDescription(description);
return inputValueDefinition;
}
}
}