Skip to content

Commit 07c529f

Browse files
author
Thomas Draier
committed
Added example to register extension
1 parent 180309a commit 07c529f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,18 @@ public class HumanExtension {
160160
Classes marked as "extensions" will actually not define a new type, but rather set new fields on the class it extends when it will be created.
161161
All GraphQL annotations can be used on extension classes.
162162

163-
Extensions are registered in GraqhQLAnnotationProcessor by using `registerTypeExtension`. Note that extensions must be registered before the type itself is requested with `getObject()`.
163+
Extensions are registered in GraqhQLAnnotationProcessor by using `registerTypeExtension`. Note that extensions must be registered before the type itself is requested with `getObject()` :
164+
165+
```
166+
GraphQLAnnotationsProcessor processor = GraphQLAnnotations.getInstance();
167+
168+
// Register extensions
169+
processor.registerTypeExtension(HumanExtension.class);
170+
171+
// Create type
172+
GraphQLObjectType type = processor.getObject(Human.class);
173+
174+
```
164175

165176
### Data fetching with extensions
166177

0 commit comments

Comments
 (0)