Package graphql.schema
Class GraphQLCodeRegistry
java.lang.Object
graphql.schema.GraphQLCodeRegistry
The
GraphQLCodeRegistry
holds that execution code that is associated with graphql types, namely
the DataFetcher
s associated with fields, the TypeResolver
s associated with
abstract types and the GraphqlFieldVisibility
For legacy reasons these code functions can still exist on the original type objects but this will be removed in a future version. Once removed the type system objects will be able have proper hashCode/equals methods and be checked for proper equality.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionDataFetcher
<?> 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
hasDataFetcher
(FieldCoordinates coordinates) Returns true if the code registry contained a data fetcher at the specified co-ordinatesstatic GraphQLCodeRegistry.Builder
static GraphQLCodeRegistry.Builder
newCodeRegistry
(GraphQLCodeRegistry existingCodeRegistry) Returns a new builder ofGraphQLCodeRegistry
objects based on the existing onetransform
(Consumer<GraphQLCodeRegistry.Builder> builderConsumer) This helps you transform the currentGraphQLCodeRegistry
object into another one by starting a builder with all the current values and allows you to transform it how you want.
-
Method Details
-
getFieldVisibility
- Returns:
- the
GraphqlFieldVisibility
-
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
-
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
-
getTypeResolver
Returns the type resolver associated with this union type- Parameters:
unionType
- the union type- Returns:
- a non null
TypeResolver
-
transform
This helps you transform the currentGraphQLCodeRegistry
object into another one by starting a builder with all the current values and allows you to transform it how you want.- Parameters:
builderConsumer
- the consumer code that will be given a builder to transform- Returns:
- a new GraphQLCodeRegistry object based on calling build on that builder
-
newCodeRegistry
- Returns:
- a new builder of
GraphQLCodeRegistry
objects
-
newCodeRegistry
Returns a new builder ofGraphQLCodeRegistry
objects based on the existing one- Parameters:
existingCodeRegistry
- the existing code registry to use- Returns:
- a new builder of
GraphQLCodeRegistry
objects
-