You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The graphql-java-annotations library is able to create GraphQLType objects out of your Java classes.
53
+
These GraphQLType objects can be later injected into the graphql-java schema.
54
+
55
+
graphql-java-annotations also allows you to wire your objects with data fetchers and type resolvers while annotating your fields/types. The result of this process will be a ``GraphQLCodeRegistry.Builder`` object that can be later built and injected to the graphql-java schema.
56
+
57
+
58
+
## GraphQLAnnotations class
59
+
60
+
You can create an instance of the `GraphQLAnnotations` class in order to create the GraphQL types.
Then you can use these types in order to create a graphql-java schema.
75
+
But, in order to create a graphql-java schema, you need also the ``GraphQLCodeRegistry``, which contains all the data fetchers mapped to their fields (and also type resolvers).
An instance of the type resolver will be created from the specified class. If a `getInstance` method is present on the
@@ -283,13 +342,11 @@ public class HumanExtension {
283
342
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.
284
343
All GraphQL annotations can be used on extension classes.
285
344
286
-
Extensions are registered in GraphQLAnnotationProcessor by using `registerTypeExtension`. Note that extensions must be registered before the type itself is requested with `getObject()` :
345
+
Extensions are registered in GraphQLAnnotations object by using `registerTypeExtension`. Note that extensions must be registered before the type itself is requested with `getObject()` :
You can also use the `field.transform` method in order to change some of the field's properties.
454
+
395
455
This class turns your string field to upper case if the directive argument "isActive" is set to true.
396
456
Now, you have to wire the field itself:
397
457
```java
@@ -431,7 +491,7 @@ NOTE: because `PropertyDataFetcher` and `FieldDataFetcher` can't handle connecti
431
491
### Customizing Relay schema
432
492
433
493
By default, GraphQLAnnotations will use the `graphql.relay.Relay` class to create the Relay specific schema types (Mutations, Connections, Edges, PageInfo, ...).
434
-
It is possible to set a custom implementation of the Relay class with `GraphQLAnnotations.setRelay` method. The class should inherit from `graphql.relay.Relay` and
494
+
It is possible to set a custom implementation of the Relay class with `graphqlAnnotations.setRelay` method. The class should inherit from `graphql.relay.Relay` and
435
495
can redefine methods that create Relay types.
436
496
437
497
It is also possible to specify for every connection which relay do you want to use, by giving a value to the annotation:
0 commit comments