Package graphql.normalized
Class ExecutableNormalizedOperation
java.lang.Object
graphql.normalized.ExecutableNormalizedOperation
A
ExecutableNormalizedOperation represent how the text of a graphql operation (sometimes known colloquially as a query)
will be executed at runtime according to the graphql specification. It handles complex mechanisms like merging
duplicate fields into one and also detecting when the types of a given field may actually be for more than one possible object
type.
An operation consists of a list of ExecutableNormalizedFields in a parent child hierarchy
-
Constructor Summary
ConstructorsConstructorDescriptionExecutableNormalizedOperation(OperationDefinition.Operation operation, String operationName, List<ExecutableNormalizedField> topLevelFields, com.google.common.collect.ImmutableListMultimap<Field, ExecutableNormalizedField> fieldToNormalizedField, Map<ExecutableNormalizedField, MergedField> normalizedFieldToMergedField, Map<ExecutableNormalizedField, QueryDirectives> normalizedFieldToQueryDirectives, com.google.common.collect.ImmutableListMultimap<FieldCoordinates, ExecutableNormalizedField> coordinatesToNormalizedFields, int operationFieldCount, int operationDepth) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.ImmutableListMultimap<FieldCoordinates, ExecutableNormalizedField> This multimap shows how a givenExecutableNormalizedFieldmaps to a one or more field coordinate in the schemacom.google.common.collect.ImmutableListMultimap<Field, ExecutableNormalizedField> This is a multimap and the size of it reflects all the normalized fields in the operationgetMergedField(ExecutableNormalizedField executableNormalizedField) Looks up theMergedFieldgiven aExecutableNormalizedFieldgetNormalizedField(MergedField mergedField, GraphQLFieldsContainer fieldsContainer, ResultPath resultPath) This will find aExecutableNormalizedFieldgiven a merged field and a result path.getNormalizedFields(Field field) Looks up one or moreExecutableNormalizedFields given aFieldAST element in the operationintintgetQueryDirectives(ExecutableNormalizedField executableNormalizedField) This looks up theQueryDirectivesassociated with the givenExecutableNormalizedField
-
Constructor Details
-
ExecutableNormalizedOperation
public ExecutableNormalizedOperation(OperationDefinition.Operation operation, String operationName, List<ExecutableNormalizedField> topLevelFields, com.google.common.collect.ImmutableListMultimap<Field, ExecutableNormalizedField> fieldToNormalizedField, Map<ExecutableNormalizedField, MergedField> normalizedFieldToMergedField, Map<ExecutableNormalizedField, QueryDirectives> normalizedFieldToQueryDirectives, com.google.common.collect.ImmutableListMultimap<FieldCoordinates, ExecutableNormalizedField> coordinatesToNormalizedFields, int operationFieldCount, int operationDepth)
-
-
Method Details
-
getOperation
- Returns:
- operation AST being executed
-
getOperationName
- Returns:
- the operation name, which can be null
-
getOperationFieldCount
public int getOperationFieldCount()- Returns:
- This returns how many
ExecutableNormalizedFields are in the operation.
-
getOperationDepth
public int getOperationDepth()- Returns:
- This returns the depth of the operation
-
getCoordinatesToNormalizedFields
public com.google.common.collect.ImmutableListMultimap<FieldCoordinates,ExecutableNormalizedField> getCoordinatesToNormalizedFields()This multimap shows how a givenExecutableNormalizedFieldmaps to a one or more field coordinate in the schema- Returns:
- a multimap of fields to schema field coordinates
-
getTopLevelFields
- Returns:
- a list of the top level
ExecutableNormalizedFields in this operation.
-
getFieldToNormalizedField
public com.google.common.collect.ImmutableListMultimap<Field,ExecutableNormalizedField> getFieldToNormalizedField()This is a multimap and the size of it reflects all the normalized fields in the operation- Returns:
- an immutable list multimap of
FieldtoExecutableNormalizedField
-
getNormalizedFields
Looks up one or moreExecutableNormalizedFields given aFieldAST element in the operation- Parameters:
field- the field to look up- Returns:
- zero, one or more possible
ExecutableNormalizedFields that represent that field
-
getNormalizedFieldToMergedField
- Returns:
- a map of
ExecutableNormalizedFieldtoMergedFields
-
getMergedField
Looks up theMergedFieldgiven aExecutableNormalizedField- Parameters:
executableNormalizedField- the field to use the key- Returns:
- a
MergedFieldor null if its not present
-
getNormalizedFieldToQueryDirectives
- Returns:
- a map of
ExecutableNormalizedFieldto itsQueryDirectives
-
getQueryDirectives
This looks up theQueryDirectivesassociated with the givenExecutableNormalizedField- Parameters:
executableNormalizedField- the executable normalised field in question- Returns:
- the fields query directives or null
-
getNormalizedField
public ExecutableNormalizedField getNormalizedField(MergedField mergedField, GraphQLFieldsContainer fieldsContainer, ResultPath resultPath) This will find aExecutableNormalizedFieldgiven a merged field and a result path. If this does not find a field it will assert with an exception- Parameters:
mergedField- the merged fieldfieldsContainer- the containing type of that fieldresultPath- the result path in play- Returns:
- the ExecutableNormalizedField
-