From e2f56ea4017b034f0db9cf0d13b597ed1fc16a92 Mon Sep 17 00:00:00 2001 From: Andreas Marek Date: Sun, 30 Apr 2017 21:26:03 +0200 Subject: [PATCH] Revert "#383 added extra readme documentation for specific references" --- README.md | 38 +--------------------- src/test/groovy/readme/ReadmeExamples.java | 26 +-------------- 2 files changed, 2 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index e6c15b92ab..de080458dd 100644 --- a/README.md +++ b/README.md @@ -295,43 +295,7 @@ GraphQLObjectType person = newObject() .build(); ``` - -##### Specific Recursive Types - -Certain situations require specific type classes as input. For example the possible union types inside a `GraphQLUnionType` are required - to be `GraphQLObjectType` objects. You can't use a `GraphQLTypeReference` in this case as it is not specifically that type. - -You can use a `reference` method on each specific type to create a reference to that type. - -```java -GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference"); -GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference"); -GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference"); - -``` - -you would use this say like this : - -```java -GraphQLUnionType PetType = newUnionType() - .name("Pet") - .possibleType(GraphQLObjectType.reference("Cat")) - .possibleType(DogType) - .typeResolver(new TypeResolver() { - @Override - public GraphQLObjectType getType(Object object) { - if (object instanceof GarfieldSchema.Cat) { - return CatType; - } - if (object instanceof GarfieldSchema.Dog) { - return DogType; - } - return null; - } - }) - .build(); - -``` + #### Data fetching diff --git a/src/test/groovy/readme/ReadmeExamples.java b/src/test/groovy/readme/ReadmeExamples.java index fc88c76715..8d861ea760 100644 --- a/src/test/groovy/readme/ReadmeExamples.java +++ b/src/test/groovy/readme/ReadmeExamples.java @@ -131,6 +131,7 @@ public GraphQLObjectType getType(Object object) { .build(); } + void recursiveTypes() { GraphQLObjectType person = newObject() @@ -141,31 +142,6 @@ void recursiveTypes() { .build(); } - void recursiveTypesSpecifically() { - - GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference"); - GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference"); - GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference"); - - GraphQLUnionType PetType = newUnionType() - .name("Pet") - .possibleType(GraphQLObjectType.reference("Cat")) - .possibleType(DogType) - .typeResolver(new TypeResolver() { - @Override - public GraphQLObjectType getType(Object object) { - if (object instanceof GarfieldSchema.Cat) { - return CatType; - } - if (object instanceof GarfieldSchema.Dog) { - return DogType; - } - return null; - } - }) - .build(); - } - void executionStrategies() { ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(