File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,43 +295,7 @@ GraphQLObjectType person = newObject()
295295 .build();
296296
297297```
298-
299- ##### Specific Recursive Types
300-
301- Certain situations require specific type classes as input. For example the possible union types inside a `GraphQLUnionType ` are required
302- to be `GraphQLObjectType ` objects. You can' t use a `GraphQLTypeReference` in this case as it is not specifically that type.
303-
304- You can use a `reference` method on each specific type to create a reference to that type.
305-
306- ```java
307- GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference");
308- GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference");
309- GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference");
310-
311- ```
312-
313- you would use this say like this :
314-
315- ```java
316- GraphQLUnionType PetType = newUnionType()
317- .name("Pet")
318- .possibleType(GraphQLObjectType.reference("Cat"))
319- .possibleType(DogType)
320- .typeResolver(new TypeResolver() {
321- @Override
322- public GraphQLObjectType getType(Object object) {
323- if (object instanceof GarfieldSchema.Cat) {
324- return CatType;
325- }
326- if (object instanceof GarfieldSchema.Dog) {
327- return DogType;
328- }
329- return null;
330- }
331- })
332- .build();
333-
334- ```
298+
335299
336300#### Data fetching
337301
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ public GraphQLObjectType getType(Object object) {
131131 .build ();
132132 }
133133
134+
134135 void recursiveTypes () {
135136
136137 GraphQLObjectType person = newObject ()
@@ -141,31 +142,6 @@ void recursiveTypes() {
141142 .build ();
142143 }
143144
144- void recursiveTypesSpecifically () {
145-
146- GraphQLObjectType objectReference = GraphQLObjectType .reference ("ObjectReference" );
147- GraphQLInterfaceType interfaceReference = GraphQLInterfaceType .reference ("InterfaceReference" );
148- GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType .reference ("InputObjectReference" );
149-
150- GraphQLUnionType PetType = newUnionType ()
151- .name ("Pet" )
152- .possibleType (GraphQLObjectType .reference ("Cat" ))
153- .possibleType (DogType )
154- .typeResolver (new TypeResolver () {
155- @ Override
156- public GraphQLObjectType getType (Object object ) {
157- if (object instanceof GarfieldSchema .Cat ) {
158- return CatType ;
159- }
160- if (object instanceof GarfieldSchema .Dog ) {
161- return DogType ;
162- }
163- return null ;
164- }
165- })
166- .build ();
167- }
168-
169145 void executionStrategies () {
170146
171147 ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor (
You can’t perform that action at this time.
0 commit comments