Package graphql.schema.idl
Class RuntimeWiring.Builder
java.lang.Object
graphql.schema.idl.RuntimeWiring.Builder
- Enclosing class:
RuntimeWiring
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GraphQLCodeRegistry
private GraphqlTypeComparatorRegistry
private final Map
<String, Map<String, DataFetcher>> private final Map
<String, DataFetcher> private final List
<SchemaDirectiveWiring> private final Map
<String, EnumValuesProvider> private GraphqlFieldVisibility
private final Map
<String, SchemaDirectiveWiring> private final Map
<String, GraphQLScalarType> private final Collection
<SchemaGeneratorPostProcessing> private final Map
<String, TypeResolver> private WiringFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
codeRegistry
(GraphQLCodeRegistry codeRegistry) This allows you to seed in your ownGraphQLCodeRegistry
instancecodeRegistry
(GraphQLCodeRegistry.Builder codeRegistry) This allows you to seed in your ownGraphQLCodeRegistry
instancecomparatorRegistry
(GraphqlTypeComparatorRegistry comparatorRegistry) You can specify your own sort order of graphql types viaGraphqlTypeComparatorRegistry
which will tell you what type of objects you are to sort when it asks for a comparator.directive
(String directiveName, SchemaDirectiveWiring schemaDirectiveWiring) This provides the wiring code for a named directive.directiveWiring
(SchemaDirectiveWiring schemaDirectiveWiring) This adds a directive wiring that will be called for all directives.fieldVisibility
(GraphqlFieldVisibility fieldVisibility) This allows you to add a field visibility that will be associated with the schemascalar
(GraphQLScalarType scalarType) This allows you to add in new custom Scalar implementations beyond the standard set.transformer
(SchemaGeneratorPostProcessing schemaGeneratorPostProcessing) Deprecated.type
(TypeRuntimeWiring typeRuntimeWiring) This adds a type wiringtype
(TypeRuntimeWiring.Builder builder) This allows you to add a new type wiring via a buildertype
(String typeName, UnaryOperator<TypeRuntimeWiring.Builder> builderFunction) This form allows a lambda to be used as the builder of a type wiringwiringFactory
(WiringFactory wiringFactory) Adds a wiring factory into the runtime wiring
-
Field Details
-
dataFetchers
-
defaultDataFetchers
-
scalars
-
typeResolvers
-
enumValuesProviders
-
registeredDirectiveWiring
-
directiveWiring
-
schemaGeneratorPostProcessings
-
wiringFactory
-
fieldVisibility
-
codeRegistry
-
comparatorRegistry
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
wiringFactory
Adds a wiring factory into the runtime wiring- Parameters:
wiringFactory
- the wiring factory to add- Returns:
- this outer builder
-
codeRegistry
This allows you to seed in your ownGraphQLCodeRegistry
instance- Parameters:
codeRegistry
- the code registry to use- Returns:
- this outer builder
-
codeRegistry
This allows you to seed in your ownGraphQLCodeRegistry
instance- Parameters:
codeRegistry
- the code registry to use- Returns:
- this outer builder
-
scalar
This allows you to add in new custom Scalar implementations beyond the standard set.- Parameters:
scalarType
- the new scalar implementation- Returns:
- the runtime wiring builder
-
fieldVisibility
This allows you to add a field visibility that will be associated with the schema- Parameters:
fieldVisibility
- the new field visibility- Returns:
- the runtime wiring builder
-
type
This allows you to add a new type wiring via a builder- Parameters:
builder
- the type wiring builder to use- Returns:
- this outer builder
-
type
public RuntimeWiring.Builder type(String typeName, UnaryOperator<TypeRuntimeWiring.Builder> builderFunction) This form allows a lambda to be used as the builder of a type wiring- Parameters:
typeName
- the name of the type to wirebuilderFunction
- a function that will be given the builder to use- Returns:
- the runtime wiring builder
-
type
This adds a type wiring- Parameters:
typeRuntimeWiring
- the new type wiring- Returns:
- the runtime wiring builder
-
directive
public RuntimeWiring.Builder directive(String directiveName, SchemaDirectiveWiring schemaDirectiveWiring) This provides the wiring code for a named directive.Note: The provided directive wiring will ONLY be called back if an element has a directive with the specified name.
To be called back for every directive the use
directiveWiring(SchemaDirectiveWiring)
or useWiringFactory.providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment)
instead.- Parameters:
directiveName
- the name of the directive to wireschemaDirectiveWiring
- the runtime behaviour of this wiring- Returns:
- the runtime wiring builder
- See Also:
-
directiveWiring
This adds a directive wiring that will be called for all directives.Note : Unlike
directive(String, SchemaDirectiveWiring)
which is only called back if a named directives is present, this directive wiring will be called back for every element in the schema even if it has zero directives.- Parameters:
schemaDirectiveWiring
- the runtime behaviour of this wiring- Returns:
- the runtime wiring builder
- See Also:
-
comparatorRegistry
You can specify your own sort order of graphql types viaGraphqlTypeComparatorRegistry
which will tell you what type of objects you are to sort when it asks for a comparator.- Parameters:
comparatorRegistry
- your own comparator registry- Returns:
- the runtime wiring builder
-
transformer
@Deprecated public RuntimeWiring.Builder transformer(SchemaGeneratorPostProcessing schemaGeneratorPostProcessing) Deprecated.This mechanism can be achieved in a better way viaSchemaTransformer
after the schema is builtAdds a schema transformer into the mix- Parameters:
schemaGeneratorPostProcessing
- the non null schema transformer to add- Returns:
- the runtime wiring builder
-
build
- Returns:
- the built runtime wiring
-
SchemaTransformer
after the schema is built