Class AbstractGraphQlSourceBuilder<B extends GraphQlSource.Builder<B>>
java.lang.Object
org.springframework.graphql.execution.AbstractGraphQlSourceBuilder<B>
- Type Parameters:
B
- the builder type
- All Implemented Interfaces:
GraphQlSource.Builder<B>
public abstract class AbstractGraphQlSourceBuilder<B extends GraphQlSource.Builder<B>>
extends Object
implements GraphQlSource.Builder<B>
Implementation of
GraphQlSource.Builder
that leaves it to subclasses
to initialize GraphQLSchema
.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev, Brian Clozel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyGraphQlConfigurers
(GraphQL.Builder builder) Protected method to apply theconfigured graphQlConfigurer
's.build()
Build theGraphQlSource
instance.configureGraphQl
(Consumer<GraphQL.Builder> configurer) Configure consumers to be given access to theGraphQL.Builder
used to buildGraphQL
.exceptionResolvers
(List<DataFetcherExceptionResolver> resolvers) AddDataFetcherExceptionResolver
's that are invoked when aDataFetcher
raises an exception.protected abstract GraphQLSchema
Subclasses must implement this method to provide theGraphQLSchema
instance.instrumentation
(List<Instrumentation> instrumentations) ProvideInstrumentation
components to instrument the execution of GraphQL queries.AddSubscriptionExceptionResolver
s that are invoked when a GraphQL subscriptionPublisher
ends with error, and given a chance to resolve the exception to one or more GraphQL errors to be sent to the client.typeVisitors
(List<GraphQLTypeVisitor> typeVisitors) AddGraphQLTypeVisitor
s to visit all element of the createdGraphQLSchema
and make changes to theGraphQLCodeRegistry
.typeVisitorsToTransformSchema
(List<GraphQLTypeVisitor> typeVisitorsToTransformSchema) Alternative toGraphQlSource.Builder.typeVisitors(List)
for visitors that also need to make schema changes.
-
Constructor Details
-
AbstractGraphQlSourceBuilder
public AbstractGraphQlSourceBuilder()
-
-
Method Details
-
exceptionResolvers
Description copied from interface:GraphQlSource.Builder
AddDataFetcherExceptionResolver
's that are invoked when aDataFetcher
raises an exception. Resolvers are invoked in sequence until one emits a list.- Specified by:
exceptionResolvers
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
- Parameters:
resolvers
- the resolvers to add- Returns:
- the current builder
-
subscriptionExceptionResolvers
Description copied from interface:GraphQlSource.Builder
AddSubscriptionExceptionResolver
s that are invoked when a GraphQL subscriptionPublisher
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.- Specified by:
subscriptionExceptionResolvers
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
- Parameters:
resolvers
- the subscription exception resolver- Returns:
- the current builder
-
typeVisitors
Description copied from interface:GraphQlSource.Builder
AddGraphQLTypeVisitor
s to visit all element of the createdGraphQLSchema
and make changes to theGraphQLCodeRegistry
.Note: Visitors are applied via
SchemaTraverser
and cannot change the schema.- Specified by:
typeVisitors
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
- Parameters:
typeVisitors
- the type visitors- Returns:
- the current builder
- See Also:
-
typeVisitorsToTransformSchema
Description copied from interface:GraphQlSource.Builder
Alternative toGraphQlSource.Builder.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 usingSchemaTraverser
, so generally preferGraphQlSource.Builder.typeVisitors(List)
if it's not necessary to change the schema.- Specified by:
typeVisitorsToTransformSchema
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
- Parameters:
typeVisitorsToTransformSchema
- the type visitors to register- Returns:
- the current builder
- See Also:
-
instrumentation
Description copied from interface:GraphQlSource.Builder
ProvideInstrumentation
components to instrument the execution of GraphQL queries.- Specified by:
instrumentation
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
- Parameters:
instrumentations
- the instrumentation components- Returns:
- the current builder
- See Also:
-
configureGraphQl
Description copied from interface:GraphQlSource.Builder
Configure consumers to be given access to theGraphQL.Builder
used to buildGraphQL
.- Specified by:
configureGraphQl
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
- Parameters:
configurer
- the configurer- Returns:
- the current builder
-
build
Description copied from interface:GraphQlSource.Builder
Build theGraphQlSource
instance.- Specified by:
build
in interfaceGraphQlSource.Builder<B extends GraphQlSource.Builder<B>>
-
initGraphQlSchema
Subclasses must implement this method to provide theGraphQLSchema
instance. -
applyGraphQlConfigurers
Protected method to apply theconfigured graphQlConfigurer
's. Subclasses can use this to customizeGraphQL.Builder
further.- Parameters:
builder
- the builder to be customized- Since:
- 1.2.5
-