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 TypeMethodDescriptionbooleancontainsDirective(String directiveName) Returns true if the named directive is presentThis returns the applied directive that theSchemaDirectiveWiringwas registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)getAppliedDirective(String directiveName) Returns a named applied directive or nullThis returns the directive that theSchemaDirectiveWiringwas 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 underlyingGraphQLCodeRegistryagainst 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:
getElementin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- the runtime element in play
-
getDirective
Description copied from interface:SchemaDirectiveWiringEnvironmentThis returns the directive that theSchemaDirectiveWiringwas 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:
getDirectivein 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:SchemaDirectiveWiringEnvironmentThis returns the applied directive that theSchemaDirectiveWiringwas 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:
getAppliedDirectivein 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:
getDirectivesin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- all of the directives that are on the runtime element
-
getDirective
Description copied from interface:SchemaDirectiveWiringEnvironmentReturns a named directive or null- Specified by:
getDirectivein interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Parameters:
directiveName- the name of the directive- Returns:
- a named directive or null
-
getAppliedDirectives
- Specified by:
getAppliedDirectivesin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- all of the directives that are on the runtime element
-
getAppliedDirective
Description copied from interface:SchemaDirectiveWiringEnvironmentReturns a named applied directive or null- Specified by:
getAppliedDirectivein interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Parameters:
directiveName- the name of the directive- Returns:
- a named directive or null
-
containsDirective
Description copied from interface:SchemaDirectiveWiringEnvironmentReturns true if the named directive is present- Specified by:
containsDirectivein interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Parameters:
directiveName- the name of the directive- Returns:
- true if the named directive is present
-
getNodeParentTree
Description copied from interface:SchemaDirectiveWiringEnvironmentThe node hierarchy depends on the element in question. For exampleObjectTypeDefinitionnodes have no parent, however aArgumentmight be on aFieldDefinitionwhich in turn might be on aObjectTypeDefinitionsay- Specified by:
getNodeParentTreein interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- hierarchical graphql language node information
-
getRegistry
- Specified by:
getRegistryin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- the type registry
-
getBuildContext
- Specified by:
getBuildContextin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a map that can be used by implementors to hold context during the SDL build process
-
getCodeRegistry
- Specified by:
getCodeRegistryin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a builder of the current code registry builder
-
getFieldsContainer
- Specified by:
getFieldsContainerin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a
GraphQLFieldsContainerwhen the element is contained with a fields container
-
getElementParentTree
Description copied from interface:SchemaDirectiveWiringEnvironmentThe type hierarchy depends on the element in question. For exampleGraphQLObjectTypeelements have no parent, however aGraphQLArgumentmight be on aGraphQLFieldDefinitionwhich in turn might be on aGraphQLObjectTypesay- Specified by:
getElementParentTreein interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- hierarchical graphql type information
-
getFieldDefinition
- Specified by:
getFieldDefinitionin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a
GraphQLFieldDefinitionwhen the element is as field or is contained within one
-
getFieldDataFetcher
Description copied from interface:SchemaDirectiveWiringEnvironmentThis is useful as a shortcut to get the current fields existing data fetcher- Specified by:
getFieldDataFetcherin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a
DataFetcherwhen the element is as field or is contained within one
-
setFieldDataFetcher
Description copied from interface:SchemaDirectiveWiringEnvironmentThis is a shortcut method to set a new data fetcher in the underlyingGraphQLCodeRegistryagainst 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:
setFieldDataFetcherin 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
-