Interface GraphQlSource.Builder<B extends GraphQlSource.Builder<B>>

Type Parameters:
B - the builder type
All Known Subinterfaces:
GraphQlSource.SchemaResourceBuilder
All Known Implementing Classes:
AbstractGraphQlSourceBuilder
Enclosing interface:
GraphQlSource

public static interface GraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
Common configuration options for all GraphQlSource builders, independent of how GraphQLSchema is created.
Since:
1.0.0
Author:
Rossen Stoyanchev
  • Method Details

    • exceptionResolvers

      B exceptionResolvers(List<DataFetcherExceptionResolver> resolvers)
      Add DataFetcherExceptionResolver's that are invoked when a DataFetcher raises an exception. Resolvers are invoked in sequence until one emits a list.
      Parameters:
      resolvers - the resolvers to add
      Returns:
      the current builder
    • subscriptionExceptionResolvers

      B subscriptionExceptionResolvers(List<SubscriptionExceptionResolver> resolvers)
      Add SubscriptionExceptionResolvers that are invoked when a GraphQL subscription Publisher ends with error, and given a chance to resolve the exception to one or more GraphQL errors to be sent to the client. Resolvers are invoked in sequence until one emits a list.
      Parameters:
      resolvers - the subscription exception resolver
      Returns:
      the current builder
      Since:
      1.0.1
    • typeVisitors

      B typeVisitors(List<graphql.schema.GraphQLTypeVisitor> typeVisitors)
      Add GraphQLTypeVisitors to visit all element of the created GraphQLSchema and make changes to the GraphQLCodeRegistry.

      Note: Visitors are applied via SchemaTraverser and cannot change the schema.

      Parameters:
      typeVisitors - the type visitors
      Returns:
      the current builder
      See Also:
      • SchemaTransformer.transformSchema(GraphQLSchema, GraphQLTypeVisitor)
    • typeVisitorsToTransformSchema

      B typeVisitorsToTransformSchema(List<graphql.schema.GraphQLTypeVisitor> typeVisitors)
      Alternative to typeVisitors(List) for visitors that also need to make schema changes.

      Note: Visitors are applied via SchemaTransformer, and therefore can change the schema. However, this is more expensive than using SchemaTraverser, so generally prefer typeVisitors(List) if it's not necessary to change the schema.

      Parameters:
      typeVisitors - the type visitors to register
      Returns:
      the current builder
      Since:
      1.1.0
      See Also:
      • SchemaTransformer.transformSchema(GraphQLSchema, GraphQLTypeVisitor)
    • instrumentation

      B instrumentation(List<graphql.execution.instrumentation.Instrumentation> instrumentations)
      Provide Instrumentation components to instrument the execution of GraphQL queries.
      Parameters:
      instrumentations - the instrumentation components
      Returns:
      the current builder
      See Also:
      • GraphQL.Builder.instrumentation(Instrumentation)
    • configureGraphQl

      B configureGraphQl(Consumer<graphql.GraphQL.Builder> configurer)
      Configure consumers to be given access to the GraphQL.Builder used to build GraphQL.
      Parameters:
      configurer - the configurer
      Returns:
      the current builder
    • graphQlSourceFactory

      B graphQlSourceFactory(GraphQlSource.Factory factory)
      Configure a factory to use to create the GraphQlSource instance to return from the build() method.

      By default, the instance is a simple container of GraphQL and GraphQLSchema. Applications can use this to create a different implementation that applies additional per-request logic.

      Parameters:
      factory - the factory to use
      Returns:
      the current builder
      Since:
      1.4.0
    • build

      GraphQlSource build()
      Build the GraphQlSource instance.