Class NormalizedOperation


  • @ExperimentalApi
    public class NormalizedOperation
    extends java.lang.Object
    A NormalizedOperation 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 NormalizedFields in a parent child hierarchy

    • Method Detail

      • getOperationName

        public java.lang.String getOperationName()
        Returns:
        the operation name, which can be null
      • getOperationFieldCount

        public int getOperationFieldCount()
        Returns:
        This returns how many NormalizedFields are in the operation.
      • getOperationDepth

        public int getOperationDepth()
        Returns:
        This returns the depth of the operation
      • getCoordinatesToNormalizedFields

        public com.google.common.collect.ImmutableListMultimap<FieldCoordinates,​NormalizedField> getCoordinatesToNormalizedFields()
        This multimap shows how a given NormalizedField maps to a one or more field coordinate in the schema
        Returns:
        a multimap of fields to schema field coordinates
      • getFieldToNormalizedField

        public com.google.common.collect.ImmutableListMultimap<Field,​NormalizedField> 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 to NormalizedField
      • getNormalizedFields

        public java.util.List<NormalizedField> getNormalizedFields​(Field field)
        Looks up one or more NormalizedFields given a Field AST element in the operation
        Parameters:
        field - the field to look up
        Returns:
        zero, one or more possible NormalizedFields that represent that field
      • getNormalizedField

        public NormalizedField getNormalizedField​(MergedField mergedField,
                                                  GraphQLFieldsContainer fieldsContainer,
                                                  ResultPath resultPath)
        This will find a NormalizedField 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 field
        fieldsContainer - the containing type of that field
        resultPath - the result path in play
        Returns:
        the NormalizedField