Package graphql.normalized
Class ExecutableNormalizedOperationFactory
- java.lang.Object
-
- graphql.normalized.ExecutableNormalizedOperationFactory
-
@PublicApi public class ExecutableNormalizedOperationFactory extends java.lang.Object
This factory can create aExecutableNormalizedOperation
which represents what would be executed during a given graphql operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ExecutableNormalizedOperationFactory.CollectedField
private static class
ExecutableNormalizedOperationFactory.CollectedFieldGroup
static class
ExecutableNormalizedOperationFactory.CollectNFResult
private static class
ExecutableNormalizedOperationFactory.FieldAndAstParent
static class
ExecutableNormalizedOperationFactory.Options
-
Field Summary
Fields Modifier and Type Field Description private ConditionalNodes
conditionalNodes
-
Constructor Summary
Constructors Constructor Description ExecutableNormalizedOperationFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
buildFieldWithChildren(ExecutableNormalizedField executableNormalizedField, com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> fieldAndAstParents, FieldCollectorNormalizedQueryParams fieldCollectorNormalizedQueryParams, com.google.common.collect.ImmutableListMultimap.Builder<Field,ExecutableNormalizedField> fieldNormalizedField, java.util.function.BiConsumer<ExecutableNormalizedField,MergedField> captureMergedField, com.google.common.collect.ImmutableListMultimap.Builder<FieldCoordinates,ExecutableNormalizedField> coordinatesToNormalizedFields, int curLevel, int maxLevel)
private void
collectField(FieldCollectorNormalizedQueryParams parameters, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, Field field, java.util.Set<GraphQLObjectType> possibleObjectTypes, GraphQLCompositeType astTypeCondition)
private void
collectFragmentSpread(FieldCollectorNormalizedQueryParams parameters, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, FragmentSpread fragmentSpread, java.util.Set<GraphQLObjectType> possibleObjects)
ExecutableNormalizedOperationFactory.CollectNFResult
collectFromMergedField(FieldCollectorNormalizedQueryParams parameters, ExecutableNormalizedField executableNormalizedField, com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> mergedField, int level)
ExecutableNormalizedOperationFactory.CollectNFResult
collectFromOperation(FieldCollectorNormalizedQueryParams parameters, OperationDefinition operationDefinition, GraphQLObjectType rootType)
private void
collectFromSelectionSet(FieldCollectorNormalizedQueryParams parameters, SelectionSet selectionSet, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, GraphQLCompositeType astTypeCondition, java.util.Set<GraphQLObjectType> possibleObjects)
private void
collectInlineFragment(FieldCollectorNormalizedQueryParams parameters, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, InlineFragment inlineFragment, java.util.Set<GraphQLObjectType> possibleObjects, GraphQLCompositeType astTypeCondition)
static ExecutableNormalizedOperation
createExecutableNormalizedOperation(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, CoercedVariables coercedVariableValues)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.static ExecutableNormalizedOperation
createExecutableNormalizedOperation(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition, java.util.Map<java.lang.String,FragmentDefinition> fragments, CoercedVariables coercedVariableValues)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.private ExecutableNormalizedOperation
createExecutableNormalizedOperationImplWithRawVariables(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition, java.util.Map<java.lang.String,FragmentDefinition> fragments, RawVariables rawVariables, ExecutableNormalizedOperationFactory.Options options)
static ExecutableNormalizedOperation
createExecutableNormalizedOperationWithRawVariables(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, RawVariables rawVariables)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.static ExecutableNormalizedOperation
createExecutableNormalizedOperationWithRawVariables(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, RawVariables rawVariables, GraphQLContext graphQLContext, java.util.Locale locale)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.static ExecutableNormalizedOperation
createExecutableNormalizedOperationWithRawVariables(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, RawVariables rawVariables, ExecutableNormalizedOperationFactory.Options options)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.private ExecutableNormalizedField
createNF(FieldCollectorNormalizedQueryParams parameters, ExecutableNormalizedOperationFactory.CollectedFieldGroup collectedFieldGroup, int level, ExecutableNormalizedField parent)
private void
createNFs(com.google.common.collect.ImmutableList.Builder<ExecutableNormalizedField> nfListBuilder, FieldCollectorNormalizedQueryParams parameters, java.util.Map<java.lang.String,java.util.List<ExecutableNormalizedOperationFactory.CollectedField>> fieldsByName, com.google.common.collect.ImmutableListMultimap.Builder<ExecutableNormalizedField,ExecutableNormalizedOperationFactory.FieldAndAstParent> normalizedFieldToAstFields, int level, ExecutableNormalizedField parent)
private ExecutableNormalizedOperation
createNormalizedQueryImpl(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition, java.util.Map<java.lang.String,FragmentDefinition> fragments, CoercedVariables coercedVariableValues, @Nullable java.util.Map<java.lang.String,NormalizedInputValue> normalizedVariableValues, ExecutableNormalizedOperationFactory.Options options)
Creates a new ExecutableNormalizedOperation for the provided queryprivate java.util.Map<java.lang.String,java.util.List<ExecutableNormalizedOperationFactory.CollectedField>>
fieldsByResultKey(java.util.List<ExecutableNormalizedOperationFactory.CollectedField> collectedFields)
private java.util.List<ExecutableNormalizedOperationFactory.CollectedFieldGroup>
groupByCommonParents(java.util.Collection<ExecutableNormalizedOperationFactory.CollectedField> fields)
private java.util.Set<GraphQLObjectType>
narrowDownPossibleObjects(java.util.Set<GraphQLObjectType> currentOnes, GraphQLCompositeType typeCondition, GraphQLSchema graphQLSchema)
private static MergedField
newMergedField(com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> fieldAndAstParents)
private com.google.common.collect.ImmutableSet<GraphQLObjectType>
resolvePossibleObjects(GraphQLCompositeType type, GraphQLSchema graphQLSchema)
private com.google.common.collect.ImmutableSet<GraphQLObjectType>
resolvePossibleObjects(java.util.List<GraphQLFieldDefinition> defs, GraphQLSchema graphQLSchema)
private void
updateCoordinatedToNFMap(com.google.common.collect.ImmutableListMultimap.Builder<FieldCoordinates,ExecutableNormalizedField> coordinatesToNormalizedFields, ExecutableNormalizedField topLevel)
private void
updateFieldToNFMap(ExecutableNormalizedField executableNormalizedField, com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> mergedField, com.google.common.collect.ImmutableListMultimap.Builder<Field,ExecutableNormalizedField> fieldToNormalizedField)
-
-
-
Field Detail
-
conditionalNodes
private final ConditionalNodes conditionalNodes
-
-
Method Detail
-
createExecutableNormalizedOperation
public static ExecutableNormalizedOperation createExecutableNormalizedOperation(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, CoercedVariables coercedVariableValues)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.- Parameters:
graphQLSchema
- the schema to be useddocument
- theDocument
holding the operation textoperationName
- the operation name to usecoercedVariableValues
- the coerced variables to use- Returns:
- a runtime representation of the graphql operation.
-
createExecutableNormalizedOperation
public static ExecutableNormalizedOperation createExecutableNormalizedOperation(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition, java.util.Map<java.lang.String,FragmentDefinition> fragments, CoercedVariables coercedVariableValues)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.- Parameters:
graphQLSchema
- the schema to be usedoperationDefinition
- the operation to be executedfragments
- a set of fragments associated with the operationcoercedVariableValues
- the coerced variables to use- Returns:
- a runtime representation of the graphql operation.
-
createExecutableNormalizedOperationWithRawVariables
public static ExecutableNormalizedOperation createExecutableNormalizedOperationWithRawVariables(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, RawVariables rawVariables)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.- Parameters:
graphQLSchema
- the schema to be useddocument
- theDocument
holding the operation textoperationName
- the operation name to userawVariables
- the raw variables to be coerced- Returns:
- a runtime representation of the graphql operation.
-
createExecutableNormalizedOperationWithRawVariables
public static ExecutableNormalizedOperation createExecutableNormalizedOperationWithRawVariables(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, RawVariables rawVariables, GraphQLContext graphQLContext, java.util.Locale locale)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.- Parameters:
graphQLSchema
- the schema to be useddocument
- theDocument
holding the operation textoperationName
- the operation name to userawVariables
- the raw variables that have not yet been coercedlocale
- theLocale
to use during coerciongraphQLContext
- theGraphQLContext
to use during coercion- Returns:
- a runtime representation of the graphql operation.
-
createExecutableNormalizedOperationWithRawVariables
public static ExecutableNormalizedOperation createExecutableNormalizedOperationWithRawVariables(GraphQLSchema graphQLSchema, Document document, java.lang.String operationName, RawVariables rawVariables, ExecutableNormalizedOperationFactory.Options options)
This will create a runtime representation of the graphql operation that would be executed in a runtime sense.- Parameters:
graphQLSchema
- the schema to be useddocument
- theDocument
holding the operation textoperationName
- the operation name to userawVariables
- the raw variables that have not yet been coercedoptions
- theExecutableNormalizedOperationFactory.Options
to use for parsing- Returns:
- a runtime representation of the graphql operation.
-
createExecutableNormalizedOperationImplWithRawVariables
private ExecutableNormalizedOperation createExecutableNormalizedOperationImplWithRawVariables(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition, java.util.Map<java.lang.String,FragmentDefinition> fragments, RawVariables rawVariables, ExecutableNormalizedOperationFactory.Options options)
-
createNormalizedQueryImpl
private ExecutableNormalizedOperation createNormalizedQueryImpl(GraphQLSchema graphQLSchema, OperationDefinition operationDefinition, java.util.Map<java.lang.String,FragmentDefinition> fragments, CoercedVariables coercedVariableValues, @Nullable @Nullable java.util.Map<java.lang.String,NormalizedInputValue> normalizedVariableValues, ExecutableNormalizedOperationFactory.Options options)
Creates a new ExecutableNormalizedOperation for the provided query
-
buildFieldWithChildren
private void buildFieldWithChildren(ExecutableNormalizedField executableNormalizedField, com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> fieldAndAstParents, FieldCollectorNormalizedQueryParams fieldCollectorNormalizedQueryParams, com.google.common.collect.ImmutableListMultimap.Builder<Field,ExecutableNormalizedField> fieldNormalizedField, java.util.function.BiConsumer<ExecutableNormalizedField,MergedField> captureMergedField, com.google.common.collect.ImmutableListMultimap.Builder<FieldCoordinates,ExecutableNormalizedField> coordinatesToNormalizedFields, int curLevel, int maxLevel)
-
newMergedField
private static MergedField newMergedField(com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> fieldAndAstParents)
-
updateFieldToNFMap
private void updateFieldToNFMap(ExecutableNormalizedField executableNormalizedField, com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> mergedField, com.google.common.collect.ImmutableListMultimap.Builder<Field,ExecutableNormalizedField> fieldToNormalizedField)
-
updateCoordinatedToNFMap
private void updateCoordinatedToNFMap(com.google.common.collect.ImmutableListMultimap.Builder<FieldCoordinates,ExecutableNormalizedField> coordinatesToNormalizedFields, ExecutableNormalizedField topLevel)
-
collectFromMergedField
public ExecutableNormalizedOperationFactory.CollectNFResult collectFromMergedField(FieldCollectorNormalizedQueryParams parameters, ExecutableNormalizedField executableNormalizedField, com.google.common.collect.ImmutableList<ExecutableNormalizedOperationFactory.FieldAndAstParent> mergedField, int level)
-
fieldsByResultKey
private java.util.Map<java.lang.String,java.util.List<ExecutableNormalizedOperationFactory.CollectedField>> fieldsByResultKey(java.util.List<ExecutableNormalizedOperationFactory.CollectedField> collectedFields)
-
collectFromOperation
public ExecutableNormalizedOperationFactory.CollectNFResult collectFromOperation(FieldCollectorNormalizedQueryParams parameters, OperationDefinition operationDefinition, GraphQLObjectType rootType)
-
createNFs
private void createNFs(com.google.common.collect.ImmutableList.Builder<ExecutableNormalizedField> nfListBuilder, FieldCollectorNormalizedQueryParams parameters, java.util.Map<java.lang.String,java.util.List<ExecutableNormalizedOperationFactory.CollectedField>> fieldsByName, com.google.common.collect.ImmutableListMultimap.Builder<ExecutableNormalizedField,ExecutableNormalizedOperationFactory.FieldAndAstParent> normalizedFieldToAstFields, int level, ExecutableNormalizedField parent)
-
createNF
private ExecutableNormalizedField createNF(FieldCollectorNormalizedQueryParams parameters, ExecutableNormalizedOperationFactory.CollectedFieldGroup collectedFieldGroup, int level, ExecutableNormalizedField parent)
-
groupByCommonParents
private java.util.List<ExecutableNormalizedOperationFactory.CollectedFieldGroup> groupByCommonParents(java.util.Collection<ExecutableNormalizedOperationFactory.CollectedField> fields)
-
collectFromSelectionSet
private void collectFromSelectionSet(FieldCollectorNormalizedQueryParams parameters, SelectionSet selectionSet, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, GraphQLCompositeType astTypeCondition, java.util.Set<GraphQLObjectType> possibleObjects)
-
collectFragmentSpread
private void collectFragmentSpread(FieldCollectorNormalizedQueryParams parameters, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, FragmentSpread fragmentSpread, java.util.Set<GraphQLObjectType> possibleObjects)
-
collectInlineFragment
private void collectInlineFragment(FieldCollectorNormalizedQueryParams parameters, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, InlineFragment inlineFragment, java.util.Set<GraphQLObjectType> possibleObjects, GraphQLCompositeType astTypeCondition)
-
collectField
private void collectField(FieldCollectorNormalizedQueryParams parameters, java.util.List<ExecutableNormalizedOperationFactory.CollectedField> result, Field field, java.util.Set<GraphQLObjectType> possibleObjectTypes, GraphQLCompositeType astTypeCondition)
-
narrowDownPossibleObjects
private java.util.Set<GraphQLObjectType> narrowDownPossibleObjects(java.util.Set<GraphQLObjectType> currentOnes, GraphQLCompositeType typeCondition, GraphQLSchema graphQLSchema)
-
resolvePossibleObjects
private com.google.common.collect.ImmutableSet<GraphQLObjectType> resolvePossibleObjects(java.util.List<GraphQLFieldDefinition> defs, GraphQLSchema graphQLSchema)
-
resolvePossibleObjects
private com.google.common.collect.ImmutableSet<GraphQLObjectType> resolvePossibleObjects(GraphQLCompositeType type, GraphQLSchema graphQLSchema)
-
-