@PublicApi public class GraphQLDirective extends java.lang.Object implements GraphQLNamedSchemaElement
See http://graphql.org/learn/queries/#directives for more details on the concept.
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
GraphQLDirective.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.
|
GraphQLArgument |
getArgument(java.lang.String name) |
java.util.List<GraphQLArgument> |
getArguments() |
java.util.List<GraphQLSchemaElement> |
getChildren() |
SchemaElementChildrenContainer |
getChildrenWithTypeReferences() |
DirectiveDefinition |
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.
|
boolean |
isNonRepeatable() |
boolean |
isRepeatable() |
static GraphQLDirective.Builder |
newDirective() |
static GraphQLDirective.Builder |
newDirective(GraphQLDirective existing) |
GraphQLAppliedDirective |
toAppliedDirective()
This method can be used to turn a directive that was being use as an applied directive into one.
|
java.lang.String |
toString() |
GraphQLDirective |
transform(java.util.function.Consumer<GraphQLDirective.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.
|
java.util.EnumSet<Introspection.DirectiveLocation> |
validLocations() |
GraphQLDirective |
withNewChildren(SchemaElementChildrenContainer newChildren) |
public static final java.lang.String CHILD_ARGUMENTS
public java.lang.String getName()
getName in interface GraphQLNamedSchemaElementpublic boolean isRepeatable()
public boolean isNonRepeatable()
public java.util.List<GraphQLArgument> getArguments()
public GraphQLArgument getArgument(java.lang.String name)
public java.util.EnumSet<Introspection.DirectiveLocation> validLocations()
public java.lang.String getDescription()
getDescription in interface GraphQLNamedSchemaElementpublic DirectiveDefinition getDefinition()
GraphQLNamedSchemaElementNode 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 GraphQLNamedSchemaElementpublic java.lang.String toString()
toString in class java.lang.Objectpublic GraphQLDirective transform(java.util.function.Consumer<GraphQLDirective.Builder> builderConsumer)
builderConsumer - the consumer code that will be given a builder to transformpublic GraphQLSchemaElement copy()
GraphQLSchemaElementcopy in interface GraphQLSchemaElementpublic TraversalControl accept(TraverserContext<GraphQLSchemaElement> context, GraphQLTypeVisitor visitor)
accept in interface GraphQLSchemaElementpublic java.util.List<GraphQLSchemaElement> getChildren()
getChildren in interface GraphQLSchemaElementpublic SchemaElementChildrenContainer getChildrenWithTypeReferences()
getChildrenWithTypeReferences in interface GraphQLSchemaElementpublic GraphQLDirective withNewChildren(SchemaElementChildrenContainer newChildren)
withNewChildren in interface GraphQLSchemaElementpublic GraphQLAppliedDirective toAppliedDirective()
GraphQLAppliedDirectivepublic final boolean equals(java.lang.Object o)
equals in interface GraphQLSchemaElementequals in class java.lang.Objecto - 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 GraphQLSchemaElementhashCode in class java.lang.Objectpublic static GraphQLDirective.Builder newDirective()
public static GraphQLDirective.Builder newDirective(GraphQLDirective existing)