Package graphql.schema.idl
Class SchemaDirectiveWiringEnvironmentImpl<T extends GraphQLDirectiveContainer>
java.lang.Object
graphql.schema.idl.SchemaDirectiveWiringEnvironmentImpl<T>
- All Implemented Interfaces:
SchemaDirectiveWiringEnvironment<T>
public class SchemaDirectiveWiringEnvironmentImpl<T extends GraphQLDirectiveContainer>
extends Object
implements SchemaDirectiveWiringEnvironment<T>
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaDirectiveWiringEnvironmentImpl
(T element, List<GraphQLDirective> directives, List<GraphQLAppliedDirective> appliedDirectives, GraphQLAppliedDirective registeredAppliedDirective, GraphQLDirective registeredDirective, graphql.schema.idl.SchemaGeneratorDirectiveHelper.Parameters parameters) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsDirective
(String directiveName) Returns true if the named directive is presentThis returns the applied directive that theSchemaDirectiveWiring
was registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)
getAppliedDirective
(String directiveName) Returns a named applied directive or nullThis returns the directive that theSchemaDirectiveWiring
was registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)
getDirective
(String directiveName) Returns a named directive or nullThe type hierarchy depends on the element in question.DataFetcher
<?> This is useful as a shortcut to get the current fields existing data fetcherThe node hierarchy depends on the element in question.setFieldDataFetcher
(DataFetcher<?> newDataFetcher) This is a shortcut method to set a new data fetcher in the underlyingGraphQLCodeRegistry
against the current field.
-
Constructor Details
-
SchemaDirectiveWiringEnvironmentImpl
public SchemaDirectiveWiringEnvironmentImpl(T element, List<GraphQLDirective> directives, List<GraphQLAppliedDirective> appliedDirectives, GraphQLAppliedDirective registeredAppliedDirective, GraphQLDirective registeredDirective, graphql.schema.idl.SchemaGeneratorDirectiveHelper.Parameters parameters)
-
-
Method Details
-
getElement
- Specified by:
getElement
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- the runtime element in play
-
getDirective
Description copied from interface:SchemaDirectiveWiringEnvironment
This returns the directive that theSchemaDirectiveWiring
was registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)
If this method of registration is not used (say because
WiringFactory.providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment)
orRuntimeWiring.Builder.directiveWiring(SchemaDirectiveWiring)
was used) then this will return null.- Specified by:
getDirective
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- the directive that was registered under specific directive name or null if it was not registered this way
-
getAppliedDirective
Description copied from interface:SchemaDirectiveWiringEnvironment
This returns the applied directive that theSchemaDirectiveWiring
was registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)
If this method of registration is not used (say because
WiringFactory.providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment)
orRuntimeWiring.Builder.directiveWiring(SchemaDirectiveWiring)
was used) then this will return null.- Specified by:
getAppliedDirective
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- the applied directive that was registered under specific directive name or null if it was not registered this way
-
getDirectives
- Specified by:
getDirectives
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- all of the directives that are on the runtime element
-
getDirective
Description copied from interface:SchemaDirectiveWiringEnvironment
Returns a named directive or null- Specified by:
getDirective
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Parameters:
directiveName
- the name of the directive- Returns:
- a named directive or null
-
getAppliedDirectives
- Specified by:
getAppliedDirectives
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- all of the directives that are on the runtime element
-
getAppliedDirective
Description copied from interface:SchemaDirectiveWiringEnvironment
Returns a named applied directive or null- Specified by:
getAppliedDirective
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Parameters:
directiveName
- the name of the directive- Returns:
- a named directive or null
-
containsDirective
Description copied from interface:SchemaDirectiveWiringEnvironment
Returns true if the named directive is present- Specified by:
containsDirective
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Parameters:
directiveName
- the name of the directive- Returns:
- true if the named directive is present
-
getNodeParentTree
Description copied from interface:SchemaDirectiveWiringEnvironment
The node hierarchy depends on the element in question. For exampleObjectTypeDefinition
nodes have no parent, however aArgument
might be on aFieldDefinition
which in turn might be on aObjectTypeDefinition
say- Specified by:
getNodeParentTree
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- hierarchical graphql language node information
-
getRegistry
- Specified by:
getRegistry
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- the type registry
-
getBuildContext
- Specified by:
getBuildContext
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- a map that can be used by implementors to hold context during the SDL build process
-
getCodeRegistry
- Specified by:
getCodeRegistry
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- a builder of the current code registry builder
-
getFieldsContainer
- Specified by:
getFieldsContainer
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- a
GraphQLFieldsContainer
when the element is contained with a fields container
-
getElementParentTree
Description copied from interface:SchemaDirectiveWiringEnvironment
The type hierarchy depends on the element in question. For exampleGraphQLObjectType
elements have no parent, however aGraphQLArgument
might be on aGraphQLFieldDefinition
which in turn might be on aGraphQLObjectType
say- Specified by:
getElementParentTree
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- hierarchical graphql type information
-
getFieldDefinition
- Specified by:
getFieldDefinition
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- a
GraphQLFieldDefinition
when the element is as field or is contained within one
-
getFieldDataFetcher
Description copied from interface:SchemaDirectiveWiringEnvironment
This is useful as a shortcut to get the current fields existing data fetcher- Specified by:
getFieldDataFetcher
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Returns:
- a
DataFetcher
when the element is as field or is contained within one
-
setFieldDataFetcher
Description copied from interface:SchemaDirectiveWiringEnvironment
This is a shortcut method to set a new data fetcher in the underlyingGraphQLCodeRegistry
against the current field.Often schema directive wiring modify behaviour by wrapping or replacing data fetchers on fields. This method is a helper to make this easier in code.
- Specified by:
setFieldDataFetcher
in interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
- Parameters:
newDataFetcher
- the new data fetcher to use for this field- Returns:
- the environments
SchemaDirectiveWiringEnvironment.getFieldDefinition()
to allow for a more fluent code style
-