2626import static graphql .schema .GraphQLInputObjectField .newInputObjectField ;
2727import static graphql .schema .GraphQLInputObjectType .newInputObject ;
2828import static graphql .schema .GraphQLInterfaceType .newInterface ;
29+ import static graphql .schema .GraphQLList .*;
30+ import static graphql .schema .GraphQLNonNull .nonNull ;
2931import static graphql .schema .GraphQLObjectType .newObject ;
3032
3133/**
@@ -44,11 +46,11 @@ public class Relay {
4446 .description ("Information about pagination in a connection." )
4547 .field (newFieldDefinition ()
4648 .name ("hasNextPage" )
47- .type (new GraphQLNonNull (GraphQLBoolean ))
49+ .type (nonNull (GraphQLBoolean ))
4850 .description ("When paginating forwards, are there more items?" ))
4951 .field (newFieldDefinition ()
5052 .name ("hasPreviousPage" )
51- .type (new GraphQLNonNull (GraphQLBoolean ))
53+ .type (nonNull (GraphQLBoolean ))
5254 .description ("When paginating backwards, are there more items?" ))
5355 .field (newFieldDefinition ()
5456 .name ("startCursor" )
@@ -68,7 +70,7 @@ public GraphQLInterfaceType nodeInterface(TypeResolver typeResolver) {
6870 .field (newFieldDefinition ()
6971 .name ("id" )
7072 .description ("The ID of an object" )
71- .type (new GraphQLNonNull (GraphQLID )))
73+ .type (nonNull (GraphQLID )))
7274 .build ();
7375 }
7476
@@ -81,7 +83,7 @@ public GraphQLFieldDefinition nodeField(GraphQLInterfaceType nodeInterface, Data
8183 .argument (newArgument ()
8284 .name ("id" )
8385 .description ("The ID of an object" )
84- .type (new GraphQLNonNull (GraphQLID )))
86+ .type (nonNull (GraphQLID )))
8587 .build ();
8688 }
8789
@@ -150,7 +152,7 @@ public GraphQLObjectType edgeType(String name, GraphQLOutputType nodeType, Graph
150152 .description ("The item at the end of the edge" ))
151153 .field (newFieldDefinition ()
152154 .name ("cursor" )
153- .type (new GraphQLNonNull (GraphQLString ))
155+ .type (nonNull (GraphQLString ))
154156 .description ("cursor marks a unique position or index into the connection" ))
155157 .fields (edgeFields )
156158 .build ();
@@ -163,11 +165,11 @@ public GraphQLObjectType connectionType(String name, GraphQLObjectType edgeType,
163165 .field (newFieldDefinition ()
164166 .name ("edges" )
165167 .description ("a list of edges" )
166- .type (new GraphQLList (edgeType )))
168+ .type (list (edgeType )))
167169 .field (newFieldDefinition ()
168170 .name ("pageInfo" )
169171 .description ("details about this specific page" )
170- .type (new GraphQLNonNull (pageInfoType )))
172+ .type (nonNull (pageInfoType )))
171173 .fields (connectionFields )
172174 .build ();
173175 }
@@ -213,7 +215,7 @@ public GraphQLFieldDefinition mutation(String name, String fieldName,
213215 .type (outputType )
214216 .argument (newArgument ()
215217 .name ("input" )
216- .type (new GraphQLNonNull (inputObjectType )))
218+ .type (nonNull (inputObjectType )))
217219 .dataFetcher (dataFetcher )
218220 .build ();
219221 }
0 commit comments