Package graphql.schema.impl
Class GraphQLTypeCollectingVisitor
- java.lang.Object
-
- graphql.schema.GraphQLTypeVisitorStub
-
- graphql.schema.impl.GraphQLTypeCollectingVisitor
-
- All Implemented Interfaces:
GraphQLTypeVisitor
public class GraphQLTypeCollectingVisitor extends GraphQLTypeVisitorStub
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,GraphQLNamedType>
indirectStrongReferences
private java.util.Map<java.lang.String,GraphQLNamedType>
result
-
Constructor Summary
Constructors Constructor Description GraphQLTypeCollectingVisitor()
-
Method Summary
-
Methods inherited from class graphql.schema.GraphQLTypeVisitorStub
visitGraphQLAppliedDirective, visitGraphQLDirective, visitGraphQLEnumValueDefinition, visitGraphQLList, visitGraphQLNonNull, visitGraphQLType, visitGraphQLTypeReference
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface graphql.schema.GraphQLTypeVisitor
changeNode, deleteNode, insertAfter, insertBefore, visitBackRef, visitGraphQLCompositeType, visitGraphQLDirectiveContainer, visitGraphQLFieldsContainer, visitGraphQLInputFieldsContainer, visitGraphQLInputType, visitGraphQLModifiedType, visitGraphQLNullableType, visitGraphQLOutputType, visitGraphQLUnmodifiedType
-
-
-
-
Field Detail
-
result
private final java.util.Map<java.lang.String,GraphQLNamedType> result
-
indirectStrongReferences
private final java.util.Map<java.lang.String,GraphQLNamedType> indirectStrongReferences
-
-
Method Detail
-
visitGraphQLEnumType
public TraversalControl visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLEnumType
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLEnumType
in classGraphQLTypeVisitorStub
-
visitGraphQLScalarType
public TraversalControl visitGraphQLScalarType(GraphQLScalarType node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLScalarType
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLScalarType
in classGraphQLTypeVisitorStub
-
visitGraphQLObjectType
public TraversalControl visitGraphQLObjectType(GraphQLObjectType node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLObjectType
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLObjectType
in classGraphQLTypeVisitorStub
-
visitGraphQLInputObjectType
public TraversalControl visitGraphQLInputObjectType(GraphQLInputObjectType node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLInputObjectType
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLInputObjectType
in classGraphQLTypeVisitorStub
-
visitGraphQLInterfaceType
public TraversalControl visitGraphQLInterfaceType(GraphQLInterfaceType node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLInterfaceType
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLInterfaceType
in classGraphQLTypeVisitorStub
-
visitGraphQLUnionType
public TraversalControl visitGraphQLUnionType(GraphQLUnionType node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLUnionType
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLUnionType
in classGraphQLTypeVisitorStub
-
visitGraphQLFieldDefinition
public TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLFieldDefinition
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLFieldDefinition
in classGraphQLTypeVisitorStub
-
visitGraphQLInputObjectField
public TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLInputObjectField
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLInputObjectField
in classGraphQLTypeVisitorStub
-
visitGraphQLArgument
public TraversalControl visitGraphQLArgument(GraphQLArgument node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLArgument
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLArgument
in classGraphQLTypeVisitorStub
-
visitGraphQLAppliedDirectiveArgument
public TraversalControl visitGraphQLAppliedDirectiveArgument(GraphQLAppliedDirectiveArgument node, TraverserContext<GraphQLSchemaElement> context)
- Specified by:
visitGraphQLAppliedDirectiveArgument
in interfaceGraphQLTypeVisitor
- Overrides:
visitGraphQLAppliedDirectiveArgument
in classGraphQLTypeVisitorStub
-
saveIndirectStrongReference
private <T> void saveIndirectStrongReference(java.util.function.Supplier<GraphQLType> typeSupplier)
-
isNotTypeReference
private boolean isNotTypeReference(java.lang.String name)
-
save
private void save(java.lang.String name, GraphQLNamedType type)
-
assertTypeUniqueness
private void assertTypeUniqueness(GraphQLNamedType type, java.util.Map<java.lang.String,GraphQLNamedType> result)
-
assertUniqueTypeObjects
private void assertUniqueTypeObjects(GraphQLNamedType type, GraphQLType existingType)
-
getResult
public com.google.common.collect.ImmutableMap<java.lang.String,GraphQLNamedType> getResult()
-
fixDanglingReplacedTypes
private java.util.Map<java.lang.String,GraphQLNamedType> fixDanglingReplacedTypes(java.util.Map<java.lang.String,GraphQLNamedType> visitedTypes)
It's possible for certain schema edits to create a situation where a field / arg / input field had a type reference, then it got replaced with an actual strong reference and then the schema gets edited such that the only reference to that type is the replaced strong reference. This edge case means that the replaced reference can be missed if it's the only way to get to that type because this visitor asks for the children as original type, e.g. the type reference and not the replaced reference.- Parameters:
visitedTypes
- the types collected by this visitor- Returns:
- a fixed up map where the only
-
-