forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeKind.java
More file actions
35 lines (31 loc) · 927 Bytes
/
TypeKind.java
File metadata and controls
35 lines (31 loc) · 927 Bytes
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
package graphql.language;
import graphql.Assert;
import graphql.PublicApi;
/**
* And enumeration of the the kind of things that can be in a graphql type system
*/
@PublicApi
public enum TypeKind {
Operation, Object, Interface, Union, Enum, Scalar, InputObject;
public static TypeKind getTypeKind(TypeDefinition def) {
if (def instanceof ObjectTypeDefinition) {
return Object;
}
if (def instanceof InterfaceTypeDefinition) {
return Interface;
}
if (def instanceof UnionTypeDefinition) {
return Union;
}
if (def instanceof ScalarTypeDefinition) {
return Scalar;
}
if (def instanceof EnumTypeDefinition) {
return Enum;
}
if (def instanceof InputObjectTypeDefinition) {
return InputObject;
}
return Assert.assertShouldNeverHappen();
}
}