public class SchemaDirectiveWiringEnvironmentImpl<T extends GraphQLDirectiveContainer> extends java.lang.Object implements SchemaDirectiveWiringEnvironment<T>
Constructor and Description |
---|
SchemaDirectiveWiringEnvironmentImpl(T element,
java.util.List<GraphQLDirective> directives,
java.util.List<GraphQLAppliedDirective> appliedDirectives,
GraphQLAppliedDirective registeredAppliedDirective,
GraphQLDirective registeredDirective,
graphql.schema.idl.SchemaGeneratorDirectiveHelper.Parameters parameters) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsDirective(java.lang.String directiveName)
Returns true if the named directive is present
|
GraphQLAppliedDirective |
getAppliedDirective()
This returns the applied directive that the
SchemaDirectiveWiring was registered
against during calls to RuntimeWiring.Builder.directive(String, SchemaDirectiveWiring) |
GraphQLAppliedDirective |
getAppliedDirective(java.lang.String directiveName)
Returns a named applied directive or null
|
java.util.Map<java.lang.String,GraphQLAppliedDirective> |
getAppliedDirectives() |
java.util.Map<java.lang.String,java.lang.Object> |
getBuildContext() |
GraphQLCodeRegistry.Builder |
getCodeRegistry() |
GraphQLDirective |
getDirective()
This returns the directive that the
SchemaDirectiveWiring was registered
against during calls to RuntimeWiring.Builder.directive(String, SchemaDirectiveWiring) |
GraphQLDirective |
getDirective(java.lang.String directiveName)
Returns a named directive or null
|
java.util.Map<java.lang.String,GraphQLDirective> |
getDirectives() |
T |
getElement() |
GraphqlElementParentTree |
getElementParentTree()
The type hierarchy depends on the element in question.
|
DataFetcher<?> |
getFieldDataFetcher()
This is useful as a shortcut to get the current fields existing data fetcher
|
GraphQLFieldDefinition |
getFieldDefinition() |
GraphQLFieldsContainer |
getFieldsContainer() |
NodeParentTree<NamedNode<?>> |
getNodeParentTree()
The node hierarchy depends on the element in question.
|
TypeDefinitionRegistry |
getRegistry() |
GraphQLFieldDefinition |
setFieldDataFetcher(DataFetcher<?> newDataFetcher)
This is a shortcut method to set a new data fetcher in the underlying
GraphQLCodeRegistry
against the current field. |
public SchemaDirectiveWiringEnvironmentImpl(T element, java.util.List<GraphQLDirective> directives, java.util.List<GraphQLAppliedDirective> appliedDirectives, GraphQLAppliedDirective registeredAppliedDirective, GraphQLDirective registeredDirective, graphql.schema.idl.SchemaGeneratorDirectiveHelper.Parameters parameters)
public T getElement()
getElement
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLDirective getDirective()
SchemaDirectiveWiringEnvironment
SchemaDirectiveWiring
was registered
against during calls to RuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)
If this method of registration is not used (say because
WiringFactory.providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment)
or
RuntimeWiring.Builder.directiveWiring(SchemaDirectiveWiring)
was used)
then this will return null.
getDirective
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLAppliedDirective getAppliedDirective()
SchemaDirectiveWiringEnvironment
SchemaDirectiveWiring
was registered
against during calls to RuntimeWiring.Builder.directive(String, SchemaDirectiveWiring)
If this method of registration is not used (say because
WiringFactory.providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment)
or
RuntimeWiring.Builder.directiveWiring(SchemaDirectiveWiring)
was used)
then this will return null.
getAppliedDirective
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public java.util.Map<java.lang.String,GraphQLDirective> getDirectives()
getDirectives
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLDirective getDirective(java.lang.String directiveName)
SchemaDirectiveWiringEnvironment
getDirective
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
directiveName
- the name of the directivepublic java.util.Map<java.lang.String,GraphQLAppliedDirective> getAppliedDirectives()
getAppliedDirectives
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLAppliedDirective getAppliedDirective(java.lang.String directiveName)
SchemaDirectiveWiringEnvironment
getAppliedDirective
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
directiveName
- the name of the directivepublic boolean containsDirective(java.lang.String directiveName)
SchemaDirectiveWiringEnvironment
containsDirective
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
directiveName
- the name of the directivepublic NodeParentTree<NamedNode<?>> getNodeParentTree()
SchemaDirectiveWiringEnvironment
ObjectTypeDefinition
nodes
have no parent, however a Argument
might be on a FieldDefinition
which in turn might be on a ObjectTypeDefinition
saygetNodeParentTree
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public TypeDefinitionRegistry getRegistry()
getRegistry
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public java.util.Map<java.lang.String,java.lang.Object> getBuildContext()
getBuildContext
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLCodeRegistry.Builder getCodeRegistry()
getCodeRegistry
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLFieldsContainer getFieldsContainer()
getFieldsContainer
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
GraphQLFieldsContainer
when the element is contained with a fields containerpublic GraphqlElementParentTree getElementParentTree()
SchemaDirectiveWiringEnvironment
GraphQLObjectType
elements
have no parent, however a GraphQLArgument
might be on a GraphQLFieldDefinition
which in turn might be on a GraphQLObjectType
saygetElementParentTree
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
public GraphQLFieldDefinition getFieldDefinition()
getFieldDefinition
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
GraphQLFieldDefinition
when the element is as field or is contained within onepublic DataFetcher<?> getFieldDataFetcher()
SchemaDirectiveWiringEnvironment
getFieldDataFetcher
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
DataFetcher
when the element is as field or is contained within onepublic GraphQLFieldDefinition setFieldDataFetcher(DataFetcher<?> newDataFetcher)
SchemaDirectiveWiringEnvironment
GraphQLCodeRegistry
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.
setFieldDataFetcher
in interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
newDataFetcher
- the new data fetcher to use for this fieldSchemaDirectiveWiringEnvironment.getFieldDefinition()
to allow for a more fluent code style