Package com.jsgalactic.axiom.graphql
Class GraphQl.Builder
java.lang.Object
com.jsgalactic.axiom.graphql.GraphQl.Builder
- Enclosing class:
GraphQl
Builds a
GraphQl; not thread-safe, build once at startup.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Parses the schema, composes the instrumentation and builds the handler.dataLoaders(Supplier<Object> dataLoaders) Sets a factory for the per-request DataLoader registry.Supplies the application-owned runtime.options(GraphQlOptions options) Sets request and query bounds.Sets the SDL schema.
-
Method Details
-
schema
Sets the SDL schema. It is parsed and validated whenbuild()runs.- Parameters:
sdl- GraphQL schema definition language, non-blank- Returns:
- this builder
-
graphQL
Supplies the application-owned runtime. The value must be agraphql.GraphQL; anything else fails the build. The instance is never modified: the adapter derives a transform that adds its own instrumentation around the existing configuration.- Parameters:
graphQL- application-ownedgraphql.GraphQLinstance- Returns:
- this builder
-
options
Sets request and query bounds. Defaults toGraphQlOptions.DEFAULT.- Parameters:
options- immutable bounds- Returns:
- this builder
-
dataLoaders
Sets a factory for the per-request DataLoader registry. It must return aorg.dataloader.DataLoaderRegistry; the parameter and result are typed asObjectso no graphql-java type appears in this API. Without a factory each request gets a fresh empty registry.- Parameters:
dataLoaders- thread-safe factory called once per request- Returns:
- this builder
-
build
Parses the schema, composes the instrumentation and builds the handler.- Returns:
- an immutable adapter
- Throws:
IllegalArgumentException- if the SDL or the supplied runtime is invalidIllegalStateException- if no schema was supplied
-