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 GraphQLArgumentargumentprivate java.util.List<InputValueWithState>defaultValueStackprivate GraphQLDirectivedirectiveprivate java.util.List<GraphQLFieldDefinition>fieldDefStackprivate java.util.List<GraphQLInputType>inputTypeStackprivate java.util.List<java.lang.String>nameStackprivate java.util.List<GraphQLOutputType>outputTypeStackprivate java.util.List<GraphQLCompositeType>parentTypeStackprivate GraphQLSchemaschema
-
Constructor Summary
Constructors Constructor Description TraversalContext(GraphQLSchema graphQLSchema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddDefaultValue(InputValueWithState defaultValue)private voidaddFieldDef(GraphQLFieldDefinition fieldDefinition)private voidaddInputType(GraphQLInputType graphQLInputType)private voidaddOutputType(GraphQLOutputType type)private voidaddParentType(GraphQLCompositeType compositeType)voidenter(Node node, java.util.List<Node> path)private voidenterImpl(Argument argument)private voidenterImpl(ArrayValue arrayValue)private voidenterImpl(Directive directive)private voidenterImpl(Field field)private voidenterImpl(FragmentDefinition fragmentDefinition)private voidenterImpl(InlineFragment inlineFragment)private voidenterImpl(ObjectField objectField)private voidenterImpl(OperationDefinition operationDefinition)private voidenterImpl(SelectionSet selectionSet)private voidenterImpl(VariableDefinition variableDefinition)private voidenterName(java.lang.String name)private GraphQLArgumentfind(java.util.List<GraphQLArgument> arguments, java.lang.String name)GraphQLArgumentgetArgument()InputValueWithStategetDefaultValue()GraphQLDirectivegetDirective()GraphQLFieldDefinitiongetFieldDef()private GraphQLFieldDefinitiongetFieldDef(GraphQLSchema schema, GraphQLType parentType, Field field)GraphQLInputTypegetInputType()private GraphQLNullableTypegetNullableType(GraphQLType type)GraphQLOutputTypegetOutputType()GraphQLCompositeTypegetParentType()java.util.List<java.lang.String>getQueryPath()private booleanisEmpty(java.lang.String name)private <T> TlastElement(java.util.List<T> list)voidleave(Node node, java.util.List<Node> ancestors)private voidleaveName(java.lang.String name)private <T> Tpop(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:
enterin 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:
leavein 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)
-
-