88
99public class SchemaUtil {
1010
11- public static boolean isLeafType (GraphQLType type ) {
11+ public boolean isLeafType (GraphQLType type ) {
1212 GraphQLUnmodifiedType unmodifiedType = getUnmodifiedType (type );
1313 return
1414 unmodifiedType instanceof GraphQLScalarType
1515 || unmodifiedType instanceof GraphQLEnumType ;
1616 }
1717
18- public static boolean isInputType (GraphQLType graphQLType ) {
18+ public boolean isInputType (GraphQLType graphQLType ) {
1919 GraphQLUnmodifiedType unmodifiedType = getUnmodifiedType (graphQLType );
2020 return
2121 unmodifiedType instanceof GraphQLScalarType
2222 || unmodifiedType instanceof GraphQLEnumType
2323 || unmodifiedType instanceof GraphQLInputObjectType ;
2424 }
2525
26- public static GraphQLUnmodifiedType getUnmodifiedType (GraphQLType graphQLType ) {
26+ public GraphQLUnmodifiedType getUnmodifiedType (GraphQLType graphQLType ) {
2727 if (graphQLType instanceof GraphQLModifiedType ) {
2828 return getUnmodifiedType (((GraphQLModifiedType ) graphQLType ).getWrappedType ());
2929 }
3030 return (GraphQLUnmodifiedType ) graphQLType ;
3131 }
3232
3333
34- private static void collectTypes (GraphQLType root , Map <String , GraphQLType > result ) {
34+ private void collectTypes (GraphQLType root , Map <String , GraphQLType > result ) {
3535 if (root instanceof GraphQLNonNull ) {
3636 collectTypes (((GraphQLNonNull ) root ).getWrappedType (), result );
3737 } else if (root instanceof GraphQLList ) {
@@ -55,14 +55,14 @@ private static void collectTypes(GraphQLType root, Map<String, GraphQLType> resu
5555 }
5656 }
5757
58- private static void collectTypesForUnions (GraphQLUnionType unionType , Map <String , GraphQLType > result ) {
58+ private void collectTypesForUnions (GraphQLUnionType unionType , Map <String , GraphQLType > result ) {
5959 for (GraphQLType type : unionType .getTypes ()) {
6060 collectTypes (type , result );
6161 }
6262
6363 }
6464
65- private static void collectTypesForInterfaces (GraphQLInterfaceType interfaceType , Map <String , GraphQLType > result ) {
65+ private void collectTypesForInterfaces (GraphQLInterfaceType interfaceType , Map <String , GraphQLType > result ) {
6666 if (result .containsKey (interfaceType .getName ())) return ;
6767 result .put (interfaceType .getName (), interfaceType );
6868
@@ -75,7 +75,7 @@ private static void collectTypesForInterfaces(GraphQLInterfaceType interfaceType
7575 }
7676
7777
78- private static void collectTypesForObjects (GraphQLObjectType objectType , Map <String , GraphQLType > result ) {
78+ private void collectTypesForObjects (GraphQLObjectType objectType , Map <String , GraphQLType > result ) {
7979 if (result .containsKey (objectType .getName ())) return ;
8080 result .put (objectType .getName (), objectType );
8181
@@ -87,12 +87,12 @@ private static void collectTypesForObjects(GraphQLObjectType objectType, Map<Str
8787 }
8888 }
8989
90- public static GraphQLType findType (GraphQLSchema schema , String name ) {
90+ public GraphQLType findType (GraphQLSchema schema , String name ) {
9191 Map <String , GraphQLType > typesByName = allTypes (schema );
9292 return typesByName .get (name );
9393 }
9494
95- public static Map <String , GraphQLType > allTypes (GraphQLSchema schema ) {
95+ public Map <String , GraphQLType > allTypes (GraphQLSchema schema ) {
9696 Map <String , GraphQLType > typesByName = new LinkedHashMap <>();
9797 collectTypes (schema .getQueryType (), typesByName );
9898 if (schema .isSupportingMutations ()) {
@@ -101,11 +101,11 @@ public static Map<String, GraphQLType> allTypes(GraphQLSchema schema) {
101101 return typesByName ;
102102 }
103103
104- public static List <GraphQLType > allTypesAsList (GraphQLSchema graphQLSchema ) {
104+ public List <GraphQLType > allTypesAsList (GraphQLSchema graphQLSchema ) {
105105 return new ArrayList <>(allTypes (graphQLSchema ).values ());
106106 }
107107
108- public static List <GraphQLObjectType > findImplementations (GraphQLSchema schema , GraphQLInterfaceType interfaceType ) {
108+ public List <GraphQLObjectType > findImplementations (GraphQLSchema schema , GraphQLInterfaceType interfaceType ) {
109109 Map <String , GraphQLType > allTypes = allTypes (schema );
110110 List <GraphQLObjectType > result = new ArrayList <>();
111111 for (GraphQLType type : allTypes .values ()) {
@@ -119,7 +119,7 @@ public static List<GraphQLObjectType> findImplementations(GraphQLSchema schema,
119119 }
120120
121121
122- static void replaceTypeReferences (GraphQLSchema schema ) {
122+ void replaceTypeReferences (GraphQLSchema schema ) {
123123 Map <String , GraphQLType > typeMap = allTypes (schema );
124124 for (GraphQLType type : typeMap .values ()) {
125125 if (type instanceof GraphQLFieldsContainer ) {
@@ -128,13 +128,13 @@ static void replaceTypeReferences(GraphQLSchema schema) {
128128 }
129129 }
130130
131- private static void resolveTypeReferencesForFieldsContainer (GraphQLFieldsContainer fieldsContainer , Map <String , GraphQLType > typeMap ) {
131+ private void resolveTypeReferencesForFieldsContainer (GraphQLFieldsContainer fieldsContainer , Map <String , GraphQLType > typeMap ) {
132132 for (GraphQLFieldDefinition fieldDefinition : fieldsContainer .getFieldDefinitions ()) {
133133 fieldDefinition .replaceTypeReferences (typeMap );
134134 }
135135 }
136136
137- static GraphQLType resolveTypeReference (GraphQLType type , Map <String , GraphQLType > typeMap ) {
137+ GraphQLType resolveTypeReference (GraphQLType type , Map <String , GraphQLType > typeMap ) {
138138 if (type instanceof GraphQLTypeReference ) {
139139 return typeMap .get (type .getName ());
140140 }
@@ -147,7 +147,7 @@ static GraphQLType resolveTypeReference(GraphQLType type, Map<String, GraphQLTyp
147147 return type ;
148148 }
149149
150- static List <GraphQLType > resolveTypeReferences (List <GraphQLType > types , Map <String , GraphQLType > typeMap ) {
150+ List <GraphQLType > resolveTypeReferences (List <GraphQLType > types , Map <String , GraphQLType > typeMap ) {
151151 List <GraphQLType > resolvedTypes = new ArrayList <>();
152152 for (GraphQLType type : types ) {
153153 resolvedTypes .add (resolveTypeReference (type , typeMap ));
0 commit comments