This repository was archived by the owner on Feb 27, 2023. It is now read-only.
forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphQLList.java
More file actions
67 lines (50 loc) · 1.81 KB
/
GraphQLList.java
File metadata and controls
67 lines (50 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
8375
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
package graphql.schema;
import graphql.PublicApi;
import java.util.Map;
import static graphql.Assert.assertNotNull;
/**
* A modified type that indicates there is a list of the underlying wrapped type, eg a list of strings or a list of booleans.
*
* See http://graphql.org/learn/schema/#lists-and-non-null for more details on the concept
*/
@PublicApi
public class GraphQLList implements GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLModifiedType, GraphQLNullableType {
/**
* A factory method for creating list types so that when used with static imports allows
* more readable code such as
* {@code .type(list(GraphQLString)) }
*
* @param wrappedType the type to wrap as being a list
*
* @return a GraphQLList of that wrapped type
*/
public static GraphQLList list(GraphQLType wrappedType) {
return new GraphQLList(wrappedType);
}
private GraphQLType wrappedType;
public GraphQLList(GraphQLType wrappedType) {
assertNotNull(wrappedType, "wrappedType can't be null");
this.wrappedType = wrappedType;
}
public GraphQLType getWrappedType() {
return wrappedType;
}
void replaceTypeReferences(Map<String, GraphQLType> typeMap) {
wrappedType = new SchemaUtil().resolveTypeReference(wrappedType, typeMap);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GraphQLList that = (GraphQLList) o;
return !(wrappedType != null ? !wrappedType.equals(that.wrappedType) : that.wrappedType != null);
}
@Override
public int hashCode() {
return wrappedType != null ? wrappedType.hashCode() : 0;
}
@Override
public String getName() {
return null;
}
}