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
[GraphQL-Java](https://github.com/andimarek/graphql-java) is a great library, but its syntax is a little bit verbose. This library offers an annotations-based
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
@@ -262,13 +342,11 @@ public class HumanExtension {
262
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.
263
343
All GraphQL annotations can be used on extension classes.
264
344
265
-
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
+
374
455
This class turns your string field to upper case if the directive argument "isActive" is set to true.
375
456
Now, you have to wire the field itself:
376
457
```java
@@ -410,7 +491,7 @@ NOTE: because `PropertyDataFetcher` and `FieldDataFetcher` can't handle connecti
410
491
### Customizing Relay schema
411
492
412
493
By default, GraphQLAnnotations will use the `graphql.relay.Relay` class to create the Relay specific schema types (Mutations, Connections, Edges, PageInfo, ...).
413
-
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
414
495
can redefine methods that create Relay types.
415
496
416
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