Repository navigation
Expand file tree
/
Copy pathField.java
More file actions
145 lines (114 loc) · 3.75 KB
/
Copy pathField.java
File metadata and controls
145 lines (114 loc) · 3.75 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
package graphql.language;
import graphql.PublicApi;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;
import java.util.ArrayList;
import java.util.List;
/*
* This is provided to a DataFetcher, therefore it is a public API.
* This might change in the future.
*/
@PublicApi
public class Field extends AbstractNode<Field> implements Selection<Field>, SelectionSetContainer<Field>, DirectivesContainer<Field> {
private String name;
private String alias;
private List<Argument> arguments;
private List<Directive> directives;
private SelectionSet selectionSet;
public Field() {
this(null, null, new ArrayList<>(), new ArrayList<>(), null);
}
public Field(String name) {
this(name, null, new ArrayList<>(), new ArrayList<>(), null);
}
public Field(String name, SelectionSet selectionSet) {
this(name, null, new ArrayList<>(), new ArrayList<>(), selectionSet);
}
public Field(String name, List<Argument> arguments) {
this(name, null, arguments, new ArrayList<>(), null);
}
public Field(String name, List<Argument> arguments, List<Directive> directives) {
this(name, null, arguments, directives, null);
}
public Field(String name, List<Argument> arguments, SelectionSet selectionSet) {
this(name, null, arguments, new ArrayList<>(), selectionSet);
}
public Field(String name, String alias, List<Argument> arguments, List<Directive> directives, SelectionSet selectionSet) {
this.name = name;
this.alias = alias;
this.arguments = arguments;
this.directives = directives;
this.selectionSet = selectionSet;
}
@Override
public List<Node> getChildren() {
List<Node> result = new ArrayList<>();
result.addAll(arguments);
result.addAll(directives);
if (selectionSet != null) result.add(selectionSet);
return result;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public List<Argument> getArguments() {
return arguments;
}
public void setArguments(List<Argument> arguments) {
this.arguments = arguments;
}
@Override
public List<Directive> getDirectives() {
return directives;
}
public void setDirectives(List<Directive> directives) {
this.directives = directives;
}
@Override
public SelectionSet getSelectionSet() {
return selectionSet;
}
public void setSelectionSet(SelectionSet selectionSet) {
this.selectionSet = selectionSet;
}
@Override
public boolean isEqualTo(Node o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Field that = (Field) o;
return NodeUtil.isEqualTo(this.name, that.name) && NodeUtil.isEqualTo(this.alias, that.alias);
}
@Override
public Field deepCopy() {
return new Field(name,
alias,
deepCopy(arguments),
deepCopy(directives),
deepCopy(selectionSet)
);
}
@Override
public String toString() {
return "Field{" +
"name='" + name + '\'' +
", alias='" + alias + '\'' +
", arguments=" + arguments +
", directives=" + directives +
", selectionSet=" + selectionSet +
'}';
}
@Override
public TraversalControl accept(TraverserContext<Node> context, NodeVisitor visitor) {
return visitor.visitField(this, context);
}
}