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 java.lang.Object implements SchemaDirectiveWiringEnvironment<T>
-
-
Constructor Summary
Constructors Constructor Description SchemaDirectiveWiringEnvironmentImpl(T element, java.util.List<GraphQLDirective> directives, java.util.List<GraphQLAppliedDirective> appliedDirectives, GraphQLAppliedDirective registeredAppliedDirective, GraphQLDirective registeredDirective, graphql.schema.idl.SchemaGeneratorDirectiveHelper.Parameters parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsDirective(java.lang.String directiveName)Returns true if the named directive is presentGraphQLAppliedDirectivegetAppliedDirective()This returns the applied directive that theSchemaDirectiveWiringwas registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)GraphQLAppliedDirectivegetAppliedDirective(java.lang.String directiveName)Returns a named applied directive or nulljava.util.Map<java.lang.String,GraphQLAppliedDirective>getAppliedDirectives()java.util.Map<java.lang.String,java.lang.Object>getBuildContext()GraphQLCodeRegistry.BuildergetCodeRegistry()GraphQLDirectivegetDirective()This returns the directive that theSchemaDirectiveWiringwas registered against during calls toRuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)GraphQLDirectivegetDirective(java.lang.String directiveName)Returns a named directive or nulljava.util.Map<java.lang.String,GraphQLDirective>getDirectives()TgetElement()GraphqlElementParentTreegetElementParentTree()The type hierarchy depends on the element in question.DataFetcher<?>getFieldDataFetcher()This is useful as a shortcut to get the current fields existing data fetcherGraphQLFieldDefinitiongetFieldDefinition()GraphQLFieldsContainergetFieldsContainer()NodeParentTree<NamedNode<?>>getNodeParentTree()The node hierarchy depends on the element in question.TypeDefinitionRegistrygetRegistry()GraphQLFieldDefinitionsetFieldDataFetcher(DataFetcher<?> newDataFetcher)This is a shortcut method to set a new data fetcher in the underlyingGraphQLCodeRegistryagainst the current field.
-
-
-
Constructor Detail
-
SchemaDirectiveWiringEnvironmentImpl
public SchemaDirectiveWiringEnvironmentImpl(T element, java.util.List<GraphQLDirective> directives, java.util.List<GraphQLAppliedDirective> appliedDirectives, GraphQLAppliedDirective registeredAppliedDirective, GraphQLDirective registeredDirective, graphql.schema.idl.SchemaGeneratorDirectiveHelper.Parameters parameters)
-
-
Method Detail
-
getElement
public T getElement()
- Specified by:
getElementin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- the runtime element in play
-
getDirective
public GraphQLDirective 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
public GraphQLAppliedDirective 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
public java.util.Map<java.lang.String,GraphQLDirective> getDirectives()
- Specified by:
getDirectivesin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- all of the directives that are on the runtime element
-
getDirective
public GraphQLDirective getDirective(java.lang.String directiveName)
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
public java.util.Map<java.lang.String,GraphQLAppliedDirective> getAppliedDirectives()
- Specified by:
getAppliedDirectivesin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- all of the directives that are on the runtime element
-
getAppliedDirective
public GraphQLAppliedDirective getAppliedDirective(java.lang.String directiveName)
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
public boolean containsDirective(java.lang.String directiveName)
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
public NodeParentTree<NamedNode<?>> 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
public TypeDefinitionRegistry getRegistry()
- Specified by:
getRegistryin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- the type registry
-
getBuildContext
public java.util.Map<java.lang.String,java.lang.Object> getBuildContext()
- Specified by:
getBuildContextin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a mpa that can be used by implementors to hold context during the SDL build process
-
getCodeRegistry
public GraphQLCodeRegistry.Builder getCodeRegistry()
- Specified by:
getCodeRegistryin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a builder of the current code registry builder
-
getFieldsContainer
public GraphQLFieldsContainer getFieldsContainer()
- Specified by:
getFieldsContainerin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a
GraphQLFieldsContainerwhen the element is contained with a fields container
-
getElementParentTree
public GraphqlElementParentTree 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
public GraphQLFieldDefinition getFieldDefinition()
- Specified by:
getFieldDefinitionin interfaceSchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>- Returns:
- a
GraphQLFieldDefinitionwhen the element is as field or is contained within one
-
getFieldDataFetcher
public DataFetcher<?> 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
public GraphQLFieldDefinition setFieldDataFetcher(DataFetcher<?> newDataFetcher)
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
-
-