Package graphql.schema
Class GraphQLCodeRegistry.Builder
java.lang.Object
graphql.schema.GraphQLCodeRegistry.Builder
- Enclosing class:
GraphQLCodeRegistry
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
dataFetcher
(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) Sets the data fetcher for a specific field inside a container typedataFetcher
(FieldCoordinates coordinates, DataFetcherFactory<?> dataFetcherFactory) Sets the data fetcher factory for a specific field inside a container typedataFetcher
(GraphQLObjectType parentType, GraphQLFieldDefinition fieldDefinition, DataFetcher<?> dataFetcher) Sets the data fetcher for a specific field inside an object typedataFetcherIfAbsent
(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) Sets the data fetcher factory for a specific field inside a container type ONLY if not mapping has already been madedataFetchers
(GraphQLCodeRegistry codeRegistry) dataFetchers
(String parentTypeName, Map<String, DataFetcher<?>> fieldDataFetchers) This allows you you to build all the data fetchers for the fields of a container type.defaultDataFetcher
(DataFetcherFactory<?> defaultDataFetcherFactory) This is the default data fetcher factory that will be used for fields that do not have specific data fetchers attached.fieldVisibility
(GraphqlFieldVisibility fieldVisibility) DataFetcher
<?> getDataFetcher
(FieldCoordinates coordinates, GraphQLFieldDefinition fieldDefinition) Returns a data fetcher associated with a field located at specified coordinates.DataFetcher
<?> getDataFetcher
(GraphQLObjectType parentType, GraphQLFieldDefinition fieldDefinition) Returns a data fetcher associated with a field within an object typegetTypeResolver
(GraphQLInterfaceType interfaceType) Returns the type resolver associated with this interface typegetTypeResolver
(GraphQLUnionType unionType) Returns the type resolver associated with this union typeboolean
boolean
hasDataFetcher
(FieldCoordinates coordinates) Returns true if the code registry contained a data fetcher at the specified co-ordinatesboolean
hasTypeResolver
(String typeName) Returns true of a type resolver has been registered for this type namesystemDataFetcher
(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) Called to place system data fetchers (eg Introspection fields) into the mixA helper method to track if the builder changes from the point at which this method was called.typeResolver
(GraphQLInterfaceType interfaceType, TypeResolver typeResolver) typeResolver
(GraphQLUnionType unionType, TypeResolver typeResolver) typeResolver
(String typeName, TypeResolver typeResolver) typeResolverIfAbsent
(GraphQLInterfaceType interfaceType, TypeResolver typeResolver) typeResolverIfAbsent
(GraphQLUnionType unionType, TypeResolver typeResolver) typeResolvers
(GraphQLCodeRegistry codeRegistry)
-
Method Details
-
trackChanges
A helper method to track if the builder changes from the point at which this method was called.- Returns:
- this builder for fluent code
-
hasChanged
public boolean hasChanged()- Returns:
- true if the builder has changed since
trackChanges()
was called
-
getDataFetcher
public DataFetcher<?> getDataFetcher(GraphQLObjectType parentType, GraphQLFieldDefinition fieldDefinition) Returns a data fetcher associated with a field within an object type- Parameters:
parentType
- the container typefieldDefinition
- the field definition- Returns:
- the DataFetcher associated with this field. All fields have data fetchers
-
getDataFetcher
public DataFetcher<?> getDataFetcher(FieldCoordinates coordinates, GraphQLFieldDefinition fieldDefinition) Returns a data fetcher associated with a field located at specified coordinates.- Parameters:
coordinates
- the field coordinatesfieldDefinition
- the field definition- Returns:
- the DataFetcher associated with this field. All fields have data fetchers
-
getDefaultDataFetcherFactory
- Returns:
- the default data fetcher factory associated with this code registry
-
hasDataFetcher
Returns true if the code registry contained a data fetcher at the specified co-ordinates- Parameters:
coordinates
- the field coordinates- Returns:
- the true if there is a data fetcher at those co-ordinates
-
getTypeResolver
Returns the type resolver associated with this interface type- Parameters:
interfaceType
- the interface type- Returns:
- a non null
TypeResolver
-
hasTypeResolver
Returns true of a type resolver has been registered for this type name- Parameters:
typeName
- the name to check- Returns:
- true if there is already a type resolver
-
getTypeResolver
Returns the type resolver associated with this union type- Parameters:
unionType
- the union type- Returns:
- a non null
TypeResolver
-
dataFetcher
public GraphQLCodeRegistry.Builder dataFetcher(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) Sets the data fetcher for a specific field inside a container type- Parameters:
coordinates
- the field coordinatesdataFetcher
- the data fetcher code for that field- Returns:
- this builder
-
dataFetcher
public GraphQLCodeRegistry.Builder dataFetcher(GraphQLObjectType parentType, GraphQLFieldDefinition fieldDefinition, DataFetcher<?> dataFetcher) Sets the data fetcher for a specific field inside an object type- Parameters:
parentType
- the object typefieldDefinition
- the field definitiondataFetcher
- the data fetcher code for that field- Returns:
- this builder
-
systemDataFetcher
public GraphQLCodeRegistry.Builder systemDataFetcher(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) Called to place system data fetchers (eg Introspection fields) into the mix- Parameters:
coordinates
- the field coordinatesdataFetcher
- the data fetcher code for that field- Returns:
- this builder
-
dataFetcher
public GraphQLCodeRegistry.Builder dataFetcher(FieldCoordinates coordinates, DataFetcherFactory<?> dataFetcherFactory) Sets the data fetcher factory for a specific field inside a container type- Parameters:
coordinates
- the field coordinatesdataFetcherFactory
- the data fetcher factory code for that field- Returns:
- this builder
-
dataFetcherIfAbsent
public GraphQLCodeRegistry.Builder dataFetcherIfAbsent(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) Sets the data fetcher factory for a specific field inside a container type ONLY if not mapping has already been made- Parameters:
coordinates
- the field coordinatesdataFetcher
- the data fetcher code for that field- Returns:
- this builder
-
dataFetchers
public GraphQLCodeRegistry.Builder dataFetchers(String parentTypeName, Map<String, DataFetcher<?>> fieldDataFetchers) This allows you you to build all the data fetchers for the fields of a container type.- Parameters:
parentTypeName
- the parent container typefieldDataFetchers
- the map of field names to data fetchers- Returns:
- this builder
-
defaultDataFetcher
public GraphQLCodeRegistry.Builder defaultDataFetcher(DataFetcherFactory<?> defaultDataFetcherFactory) This is the default data fetcher factory that will be used for fields that do not have specific data fetchers attached. By defaultPropertyDataFetcher
is used but you can have your own default via this method.- Parameters:
defaultDataFetcherFactory
- the default data fetcher factory used- Returns:
- this builder
-
dataFetchers
-
typeResolver
public GraphQLCodeRegistry.Builder typeResolver(GraphQLInterfaceType interfaceType, TypeResolver typeResolver) -
typeResolverIfAbsent
public GraphQLCodeRegistry.Builder typeResolverIfAbsent(GraphQLInterfaceType interfaceType, TypeResolver typeResolver) -
typeResolver
public GraphQLCodeRegistry.Builder typeResolver(GraphQLUnionType unionType, TypeResolver typeResolver) -
typeResolverIfAbsent
public GraphQLCodeRegistry.Builder typeResolverIfAbsent(GraphQLUnionType unionType, TypeResolver typeResolver) -
typeResolver
-
typeResolvers
-
fieldVisibility
-
clearDataFetchers
-
clearTypeResolvers
-
build
-