Package graphql.normalized
Class ExecutableNormalizedOperation
- java.lang.Object
-
- graphql.normalized.ExecutableNormalizedOperation
-
@PublicApi public class ExecutableNormalizedOperation extends java.lang.Object
AExecutableNormalizedOperation
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
ExecutableNormalizedField
s in a parent child hierarchy
-
-
Constructor Summary
Constructors Constructor Description ExecutableNormalizedOperation(OperationDefinition.Operation operation, java.lang.String operationName, java.util.List<ExecutableNormalizedField> topLevelFields, com.google.common.collect.ImmutableListMultimap<Field,ExecutableNormalizedField> fieldToNormalizedField, java.util.Map<ExecutableNormalizedField,MergedField> normalizedFieldToMergedField, java.util.Map<ExecutableNormalizedField,QueryDirectives> normalizedFieldToQueryDirectives, com.google.common.collect.ImmutableListMultimap<FieldCoordinates,ExecutableNormalizedField> coordinatesToNormalizedFields)
-
Method Summary
-
-
-
Constructor Detail
-
ExecutableNormalizedOperation
public ExecutableNormalizedOperation(OperationDefinition.Operation operation, java.lang.String operationName, java.util.List<ExecutableNormalizedField> topLevelFields, com.google.common.collect.ImmutableListMultimap<Field,ExecutableNormalizedField> fieldToNormalizedField, java.util.Map<ExecutableNormalizedField,MergedField> normalizedFieldToMergedField, java.util.Map<ExecutableNormalizedField,QueryDirectives> normalizedFieldToQueryDirectives, com.google.common.collect.ImmutableListMultimap<FieldCoordinates,ExecutableNormalizedField> coordinatesToNormalizedFields)
-
-
Method Detail
-
getOperation
public OperationDefinition.Operation getOperation()
- Returns:
- operation AST being executed
-
getOperationName
public java.lang.String getOperationName()
- Returns:
- the operation name, which can be null
-
getCoordinatesToNormalizedFields
public com.google.common.collect.ImmutableListMultimap<FieldCoordinates,ExecutableNormalizedField> getCoordinatesToNormalizedFields()
This multimap shows how a givenExecutableNormalizedField
maps to a one or more field coordinate in the schema- Returns:
- a multimap of fields to schema field coordinates
-
getTopLevelFields
public java.util.List<ExecutableNormalizedField> getTopLevelFields()
- Returns:
- a list of the top level
ExecutableNormalizedField
s 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
Field
toExecutableNormalizedField
-
getNormalizedFields
public java.util.List<ExecutableNormalizedField> getNormalizedFields(Field field)
Looks up one or moreExecutableNormalizedField
s given aField
AST element in the operation- Parameters:
field
- the field to look up- Returns:
- zero, one or more possible
ExecutableNormalizedField
s that represent that field
-
getNormalizedFieldToMergedField
public java.util.Map<ExecutableNormalizedField,MergedField> getNormalizedFieldToMergedField()
- Returns:
- a map of
ExecutableNormalizedField
toMergedField
s
-
getMergedField
public MergedField getMergedField(ExecutableNormalizedField executableNormalizedField)
Looks up theMergedField
given aExecutableNormalizedField
- Parameters:
executableNormalizedField
- the field to use the key- Returns:
- a
MergedField
or null if its not present
-
getNormalizedFieldToQueryDirectives
public java.util.Map<ExecutableNormalizedField,QueryDirectives> getNormalizedFieldToQueryDirectives()
- Returns:
- a map of
ExecutableNormalizedField
to itsQueryDirectives
-
getQueryDirectives
public QueryDirectives getQueryDirectives(ExecutableNormalizedField executableNormalizedField)
This looks up theQueryDirectives
associated 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 aExecutableNormalizedField
given 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
-
-