Package graphql.validation
Class TraversalContext
- java.lang.Object
-
- graphql.validation.TraversalContext
-
- All Implemented Interfaces:
DocumentVisitor
public class TraversalContext extends java.lang.Object implements DocumentVisitor
-
-
Field Summary
Fields Modifier and Type Field Description private GraphQLArgument
argument
private java.util.List<InputValueWithState>
defaultValueStack
private GraphQLDirective
directive
private java.util.List<GraphQLFieldDefinition>
fieldDefStack
private java.util.List<GraphQLInputType>
inputTypeStack
private java.util.List<java.lang.String>
nameStack
private java.util.List<GraphQLOutputType>
outputTypeStack
private java.util.List<GraphQLCompositeType>
parentTypeStack
private GraphQLSchema
schema
-
Constructor Summary
Constructors Constructor Description TraversalContext(GraphQLSchema graphQLSchema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addDefaultValue(InputValueWithState defaultValue)
private void
addFieldDef(GraphQLFieldDefinition fieldDefinition)
private void
addInputType(GraphQLInputType graphQLInputType)
private void
addOutputType(GraphQLOutputType type)
private void
addParentType(GraphQLCompositeType compositeType)
void
enter(Node node, java.util.List<Node> path)
private void
enterImpl(Argument argument)
private void
enterImpl(ArrayValue arrayValue)
private void
enterImpl(Directive directive)
private void
enterImpl(Field field)
private void
enterImpl(FragmentDefinition fragmentDefinition)
private void
enterImpl(InlineFragment inlineFragment)
private void
enterImpl(ObjectField objectField)
private void
enterImpl(OperationDefinition operationDefinition)
private void
enterImpl(SelectionSet selectionSet)
private void
enterImpl(VariableDefinition variableDefinition)
private void
enterName(java.lang.String name)
private GraphQLArgument
find(java.util.List<GraphQLArgument> arguments, java.lang.String name)
GraphQLArgument
getArgument()
InputValueWithState
getDefaultValue()
GraphQLDirective
getDirective()
GraphQLFieldDefinition
getFieldDef()
private GraphQLFieldDefinition
getFieldDef(GraphQLSchema schema, GraphQLType parentType, Field field)
GraphQLInputType
getInputType()
private GraphQLNullableType
getNullableType(GraphQLType type)
GraphQLOutputType
getOutputType()
GraphQLCompositeType
getParentType()
java.util.List<java.lang.String>
getQueryPath()
private boolean
isEmpty(java.lang.String name)
private <T> T
lastElement(java.util.List<T> list)
void
leave(Node node, java.util.List<Node> ancestors)
private void
leaveName(java.lang.String name)
private <T> T
pop(java.util.List<T> list)
-
-
-
Field Detail
-
schema
private final GraphQLSchema schema
-
outputTypeStack
private final java.util.List<GraphQLOutputType> outputTypeStack
-
parentTypeStack
private final java.util.List<GraphQLCompositeType> parentTypeStack
-
inputTypeStack
private final java.util.List<GraphQLInputType> inputTypeStack
-
defaultValueStack
private final java.util.List<InputValueWithState> defaultValueStack
-
fieldDefStack
private final java.util.List<GraphQLFieldDefinition> fieldDefStack
-
nameStack
private final java.util.List<java.lang.String> nameStack
-
directive
private GraphQLDirective directive
-
argument
private GraphQLArgument argument
-
-
Constructor Detail
-
TraversalContext
public TraversalContext(GraphQLSchema graphQLSchema)
-
-
Method Detail
-
enter
public void enter(Node node, java.util.List<Node> path)
- Specified by:
enter
in interfaceDocumentVisitor
-
enterImpl
private void enterImpl(SelectionSet selectionSet)
-
enterImpl
private void enterImpl(Field field)
-
enterImpl
private void enterImpl(Directive directive)
-
enterImpl
private void enterImpl(OperationDefinition operationDefinition)
-
enterImpl
private void enterImpl(InlineFragment inlineFragment)
-
enterImpl
private void enterImpl(FragmentDefinition fragmentDefinition)
-
enterImpl
private void enterImpl(VariableDefinition variableDefinition)
-
enterImpl
private void enterImpl(Argument argument)
-
enterImpl
private void enterImpl(ArrayValue arrayValue)
-
enterImpl
private void enterImpl(ObjectField objectField)
-
find
private GraphQLArgument find(java.util.List<GraphQLArgument> arguments, java.lang.String name)
-
leave
public void leave(Node node, java.util.List<Node> ancestors)
- Specified by:
leave
in interfaceDocumentVisitor
-
enterName
private void enterName(java.lang.String name)
-
leaveName
private void leaveName(java.lang.String name)
-
isEmpty
private boolean isEmpty(java.lang.String name)
-
getNullableType
private GraphQLNullableType getNullableType(GraphQLType type)
-
getOutputType
public GraphQLOutputType getOutputType()
- Returns:
- can be null if current node does not have a OutputType associated: for example if the current field is unknown
-
addOutputType
private void addOutputType(GraphQLOutputType type)
-
lastElement
private <T> T lastElement(java.util.List<T> list)
-
pop
private <T> T pop(java.util.List<T> list)
-
getParentType
public GraphQLCompositeType getParentType()
- Returns:
- can be null if the parent is not a CompositeType
-
addParentType
private void addParentType(GraphQLCompositeType compositeType)
-
getInputType
public GraphQLInputType getInputType()
-
getDefaultValue
public InputValueWithState getDefaultValue()
-
addInputType
private void addInputType(GraphQLInputType graphQLInputType)
-
addDefaultValue
private void addDefaultValue(InputValueWithState defaultValue)
-
getFieldDef
public GraphQLFieldDefinition getFieldDef()
-
getQueryPath
public java.util.List<java.lang.String> getQueryPath()
-
addFieldDef
private void addFieldDef(GraphQLFieldDefinition fieldDefinition)
-
getDirective
public GraphQLDirective getDirective()
-
getArgument
public GraphQLArgument getArgument()
-
getFieldDef
private GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLType parentType, Field field)
-
-