@PublicApi public class GraphQLAppliedDirective extends java.lang.Object implements GraphQLNamedSchemaElement
A directive has a definition, that is what arguments it takes, and it can also be applied
to other schema elements. Originally graphql-java re-used the GraphQLDirective
and GraphQLArgument
classes to do both purposes. This was a modelling mistake. New GraphQLAppliedDirective
and GraphQLAppliedDirectiveArgument
classes have been introduced to better model when a directive is applied to a schema element,
as opposed to its schema definition itself.
See https://graphql.org/learn/queries/#directives for more details on the concept.
Modifier and Type | Class and Description |
---|---|
static class |
GraphQLAppliedDirective.Builder |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHILD_ARGUMENTS |
Modifier and Type | Method and Description |
---|---|
TraversalControl |
accept(TraverserContext<GraphQLSchemaElement> context,
GraphQLTypeVisitor visitor) |
GraphQLSchemaElement |
copy()
Each GraphQLSchemaElement should make a copy of itself when this is called.
|
boolean |
equals(java.lang.Object o)
No GraphQLSchemaElement implements `equals` because we need object identity
to treat a GraphQLSchema as an abstract graph.
|
GraphQLAppliedDirectiveArgument |
getArgument(java.lang.String name) |
java.util.List<GraphQLAppliedDirectiveArgument> |
getArguments() |
java.util.List<GraphQLSchemaElement> |
getChildren() |
SchemaElementChildrenContainer |
getChildrenWithTypeReferences() |
Directive |
getDefinition()
The AST
Node this schema element is based on. |
java.lang.String |
getDescription() |
java.lang.String |
getName() |
int |
hashCode()
No GraphQLSchemaElement implements `equals/hashCode` because we need object identity
to treat a GraphQLSchema as an abstract graph.
|
static GraphQLAppliedDirective.Builder |
newDirective() |
static GraphQLAppliedDirective.Builder |
newDirective(GraphQLAppliedDirective existing) |
java.lang.String |
toString() |
GraphQLAppliedDirective |
transform(java.util.function.Consumer<GraphQLAppliedDirective.Builder> builderConsumer)
This helps you transform the current GraphQLDirective into another one by starting a builder with all
the current values and allows you to transform it how you want.
|
GraphQLAppliedDirective |
withNewChildren(SchemaElementChildrenContainer newChildren) |
public static final java.lang.String CHILD_ARGUMENTS
public java.lang.String getName()
getName
in interface GraphQLNamedSchemaElement
public java.lang.String getDescription()
getDescription
in interface GraphQLNamedSchemaElement
public java.util.List<GraphQLAppliedDirectiveArgument> getArguments()
public GraphQLAppliedDirectiveArgument getArgument(java.lang.String name)
public Directive getDefinition()
GraphQLNamedSchemaElement
Node
this schema element is based on. Is null if the GraphQLSchema
is not based on a SDL document.
Some elements also have additional extension Nodes. See for example GraphQLObjectType.getExtensionDefinitions()
getDefinition
in interface GraphQLNamedSchemaElement
public java.lang.String toString()
toString
in class java.lang.Object
public GraphQLAppliedDirective transform(java.util.function.Consumer<GraphQLAppliedDirective.Builder> builderConsumer)
builderConsumer
- the consumer code that will be given a builder to transformpublic GraphQLSchemaElement copy()
GraphQLSchemaElement
copy
in interface GraphQLSchemaElement
public TraversalControl accept(TraverserContext<GraphQLSchemaElement> context, GraphQLTypeVisitor visitor)
accept
in interface GraphQLSchemaElement
public java.util.List<GraphQLSchemaElement> getChildren()
getChildren
in interface GraphQLSchemaElement
public SchemaElementChildrenContainer getChildrenWithTypeReferences()
getChildrenWithTypeReferences
in interface GraphQLSchemaElement
public GraphQLAppliedDirective withNewChildren(SchemaElementChildrenContainer newChildren)
withNewChildren
in interface GraphQLSchemaElement
public final boolean equals(java.lang.Object o)
equals
in interface GraphQLSchemaElement
equals
in class java.lang.Object
o
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.public final int hashCode()
hashCode
in interface GraphQLSchemaElement
hashCode
in class java.lang.Object
public static GraphQLAppliedDirective.Builder newDirective()
public static GraphQLAppliedDirective.Builder newDirective(GraphQLAppliedDirective existing)