T - the type of the object in play@PublicApi public interface SchemaDirectiveWiringEnvironment<T extends GraphQLDirectiveContainer>
SchemaDirectiveWiring is passed this object as parameters
when it builds out behaviour| Modifier and Type | Method and Description |
|---|---|
boolean |
containsDirective(java.lang.String directiveName)
Returns true if the named directive is present
|
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. |
T getElement()
GraphQLDirective getDirective()
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.
java.util.Map<java.lang.String,GraphQLDirective> getDirectives()
GraphQLDirective getDirective(java.lang.String directiveName)
directiveName - the name of the directivejava.util.Map<java.lang.String,GraphQLAppliedDirective> getAppliedDirectives()
GraphQLAppliedDirective getAppliedDirective(java.lang.String directiveName)
directiveName - the name of the directiveboolean containsDirective(java.lang.String directiveName)
directiveName - the name of the directiveNodeParentTree<NamedNode<?>> getNodeParentTree()
ObjectTypeDefinition nodes
have no parent, however a Argument might be on a FieldDefinition
which in turn might be on a ObjectTypeDefinition sayGraphqlElementParentTree getElementParentTree()
GraphQLObjectType elements
have no parent, however a GraphQLArgument might be on a GraphQLFieldDefinition
which in turn might be on a GraphQLObjectType sayTypeDefinitionRegistry getRegistry()
java.util.Map<java.lang.String,java.lang.Object> getBuildContext()
GraphQLCodeRegistry.Builder getCodeRegistry()
GraphQLFieldsContainer getFieldsContainer()
GraphQLFieldsContainer when the element is contained with a fields containerGraphQLFieldDefinition getFieldDefinition()
GraphQLFieldDefinition when the element is as field or is contained within oneDataFetcher<?> getFieldDataFetcher()
DataFetcher when the element is as field or is contained within oneAssertException - if there is not field in context at the time of the directive wiring callbackGraphQLFieldDefinition setFieldDataFetcher(DataFetcher<?> newDataFetcher)
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.
newDataFetcher - the new data fetcher to use for this fieldgetFieldDefinition() to allow for a more fluent code styleAssertException - if there is not field in context at the time of the directive wiring callback