Package graphql.schema
Interface GraphQLTypeVisitor
- All Known Implementing Classes:
AppliedDirectiveArgumentsAreValid
,AppliedDirectivesAreValid
,CodeRegistryVisitor
,DefaultValuesAreValid
,DeprecatedInputObjectAndArgumentsAreValid
,GraphQLTypeCollectingVisitor
,GraphQLTypeResolvingVisitor
,GraphQLTypeVisitorStub
,InputAndOutputTypesUsedAppropriately
,MultiReadOnlyGraphQLTypeVisitor
,NoUnbrokenInputCycles
,OneOfInputObjectRules
,TypeAndFieldRule
,TypesImplementInterfaces
GraphQLTypeVisitor can be used to visit all the elements of a schema
(types, fields, directives and so on) in a visitor pattern.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault TraversalControl
changeNode
(TraverserContext<GraphQLSchemaElement> context, GraphQLSchemaElement newChangedNode) This helper method can be used to "change" a node when returning control from this visitordefault TraversalControl
deleteNode
(TraverserContext<GraphQLSchemaElement> context) This helper method can be used to "delete" the current node when returning control from this visitordefault TraversalControl
insertAfter
(TraverserContext<GraphQLSchemaElement> context, GraphQLSchemaElement toInsertAfter) This helper method can be used to "insert a new node" AFTER the current node when returning control from this visitordefault TraversalControl
insertBefore
(TraverserContext<GraphQLSchemaElement> context, GraphQLSchemaElement toInsertBefore) This helper method can be used to "insert a new node" BEFORE the current node when returning control from this visitordefault TraversalControl
visitBackRef
(TraverserContext<GraphQLSchemaElement> context) Called when a node is visited more than once within a context.default TraversalControl
visitGraphQLAppliedDirective
(GraphQLAppliedDirective node, TraverserContext<GraphQLSchemaElement> context) This method will be called when a directive is applied to a schema element.default TraversalControl
visitGraphQLAppliedDirectiveArgument
(GraphQLAppliedDirectiveArgument node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLArgument
(GraphQLArgument node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLCompositeType
(GraphQLCompositeType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLDirective
(GraphQLDirective node, TraverserContext<GraphQLSchemaElement> context) This method will be called twice.default TraversalControl
visitGraphQLDirectiveContainer
(GraphQLDirectiveContainer node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLEnumType
(GraphQLEnumType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLEnumValueDefinition
(GraphQLEnumValueDefinition node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLFieldDefinition
(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLFieldsContainer
(GraphQLFieldsContainer node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLInputFieldsContainer
(GraphQLInputFieldsContainer node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLInputObjectField
(GraphQLInputObjectField node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLInputObjectType
(GraphQLInputObjectType node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLInputType
(GraphQLInputType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLInterfaceType
(GraphQLInterfaceType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLList
(GraphQLList node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLNonNull
(GraphQLNonNull node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLObjectType
(GraphQLObjectType node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLOutputType
(GraphQLOutputType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLScalarType
(GraphQLScalarType node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLTypeReference
(GraphQLTypeReference node, TraverserContext<GraphQLSchemaElement> context) visitGraphQLUnionType
(GraphQLUnionType node, TraverserContext<GraphQLSchemaElement> context) default TraversalControl
visitGraphQLUnmodifiedType
(GraphQLUnmodifiedType node, TraverserContext<GraphQLSchemaElement> context)
-
Method Details
-
visitGraphQLAppliedDirective
default TraversalControl visitGraphQLAppliedDirective(GraphQLAppliedDirective node, TraverserContext<GraphQLSchemaElement> context) This method will be called when a directive is applied to a schema element. TheTraverserContext.getParentNode()
will be the schema element that this is applied to. The graphql-java code base is trying to slowly move away from usingGraphQLDirective
s when they really should beGraphQLAppliedDirective
s- Parameters:
node
- the applied directivecontext
- the traversal context- Returns:
- how to control the visitation processing
-
visitGraphQLAppliedDirectiveArgument
default TraversalControl visitGraphQLAppliedDirectiveArgument(GraphQLAppliedDirectiveArgument node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLArgument
TraversalControl visitGraphQLArgument(GraphQLArgument node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLDirective
TraversalControl visitGraphQLDirective(GraphQLDirective node, TraverserContext<GraphQLSchemaElement> context) This method will be called twice. Once for a directive definition in a schema and then do each time a directive is applied to a schema element When it's applied to a schema element thenTraverserContext.getParentNode()
will be the schema element that this is applied to. The graphql-java code base is trying to slowly move away from usingGraphQLDirective
s when they really should beGraphQLAppliedDirective
s and this is another place that has been left in. In the future this behavior will change and this will only visit directive definitions of a schema, not where they are applied.- Parameters:
node
- the directivecontext
- the traversal context- Returns:
- how to control the visitation processing
-
visitGraphQLEnumType
TraversalControl visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLEnumValueDefinition
TraversalControl visitGraphQLEnumValueDefinition(GraphQLEnumValueDefinition node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLFieldDefinition
TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLInputObjectField
TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLInputObjectType
TraversalControl visitGraphQLInputObjectType(GraphQLInputObjectType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLInterfaceType
TraversalControl visitGraphQLInterfaceType(GraphQLInterfaceType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLList
-
visitGraphQLNonNull
TraversalControl visitGraphQLNonNull(GraphQLNonNull node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLObjectType
TraversalControl visitGraphQLObjectType(GraphQLObjectType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLScalarType
TraversalControl visitGraphQLScalarType(GraphQLScalarType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLTypeReference
TraversalControl visitGraphQLTypeReference(GraphQLTypeReference node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLUnionType
TraversalControl visitGraphQLUnionType(GraphQLUnionType node, TraverserContext<GraphQLSchemaElement> context) -
visitBackRef
Called when a node is visited more than once within a context.TraverserContext.thisNode()
contains the node- Parameters:
context
- the traversal context- Returns:
- by default CONTINUE
-
visitGraphQLCompositeType
default TraversalControl visitGraphQLCompositeType(GraphQLCompositeType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLDirectiveContainer
default TraversalControl visitGraphQLDirectiveContainer(GraphQLDirectiveContainer node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLFieldsContainer
default TraversalControl visitGraphQLFieldsContainer(GraphQLFieldsContainer node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLInputFieldsContainer
default TraversalControl visitGraphQLInputFieldsContainer(GraphQLInputFieldsContainer node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLInputType
default TraversalControl visitGraphQLInputType(GraphQLInputType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLModifiedType
default TraversalControl visitGraphQLModifiedType(GraphQLModifiedType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLNullableType
default TraversalControl visitGraphQLNullableType(GraphQLNullableType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLOutputType
default TraversalControl visitGraphQLOutputType(GraphQLOutputType node, TraverserContext<GraphQLSchemaElement> context) -
visitGraphQLUnmodifiedType
default TraversalControl visitGraphQLUnmodifiedType(GraphQLUnmodifiedType node, TraverserContext<GraphQLSchemaElement> context) -
changeNode
default TraversalControl changeNode(TraverserContext<GraphQLSchemaElement> context, GraphQLSchemaElement newChangedNode) This helper method can be used to "change" a node when returning control from this visitor- Parameters:
context
- the current traversal contextnewChangedNode
- the new to be changed at this place- Returns:
- this will always sent back TraversalControl.CONTINUE
-
deleteNode
This helper method can be used to "delete" the current node when returning control from this visitor- Parameters:
context
- the current traversal context which is pointing to the current node to be deleted- Returns:
- this will always sent back TraversalControl.CONTINUE
-
insertAfter
default TraversalControl insertAfter(TraverserContext<GraphQLSchemaElement> context, GraphQLSchemaElement toInsertAfter) This helper method can be used to "insert a new node" AFTER the current node when returning control from this visitor- Parameters:
context
- the current traversal contexttoInsertAfter
- the new to be inserted AFTER this current code- Returns:
- this will always sent back TraversalControl.CONTINUE
-
insertBefore
default TraversalControl insertBefore(TraverserContext<GraphQLSchemaElement> context, GraphQLSchemaElement toInsertBefore) This helper method can be used to "insert a new node" BEFORE the current node when returning control from this visitor- Parameters:
context
- the current traversal contexttoInsertBefore
- the new to be inserted BEFORE this current code- Returns:
- this will always sent back TraversalControl.CONTINUE
-