Class GQLField

  • All Implemented Interfaces:
    GQLSelection

    @Immutable
    public class GQLField
    extends java.lang.Object
    implements GQLSelection
    Representation of a field in the response JSON. This is called a 'field' as it references a field of data in the JSON response, unrelated to message fields. This may represent a message field or a method call, but not both. And may always have an alias. If the type of the field, or return type of the message is a message or collection of messages, it may have a selection set.
    • Constructor Summary

      Constructors 
      Constructor Description
      GQLField​(net.morimekta.providence.descriptor.PField field)
      Make a simple field selection based on a message field.
      GQLField​(net.morimekta.providence.descriptor.PField field, java.lang.String alias, net.morimekta.providence.PMessage<?> arguments, java.util.List<GQLSelection> selectionSet)
      Make a full field selection definition.
      GQLField​(net.morimekta.providence.descriptor.PField field, java.util.List<GQLSelection> selectionSet)
      Make a simple field selection based on a message field.
    • Constructor Detail

      • GQLField

        public GQLField​(@Nonnull
                        net.morimekta.providence.descriptor.PField field)
        Make a simple field selection based on a message field.
        Parameters:
        field - The field to be represented.
      • GQLField

        public GQLField​(@Nonnull
                        net.morimekta.providence.descriptor.PField field,
                        @Nullable
                        java.util.List<GQLSelection> selectionSet)
        Make a simple field selection based on a message field.
        Parameters:
        field - The field to be represented.
        selectionSet - SelectionSet for sub-field selection.
      • GQLField

        public GQLField​(@Nonnull
                        net.morimekta.providence.descriptor.PField field,
                        @Nullable
                        java.lang.String alias,
                        @Nullable
                        net.morimekta.providence.PMessage<?> arguments,
                        @Nullable
                        java.util.List<GQLSelection> selectionSet)
        Make a full field selection definition.
        Parameters:
        field - The field to be represented.
        alias - The alias to be used in the JSON output.
        arguments - Arguments used for field mutators.
        selectionSet - SelectionSet for sub-field selection.
    • Method Detail

      • representing

        public boolean representing​(net.morimekta.providence.descriptor.PField inf)
        Check if the input field is represented with this field selection. It will match if it is the same field as this, or if it is the same field as what this field is overriding (from implementing interface).

        E.g. if 'A' is an interface field, and 'B' and 'C' are the equivalent field in two different messages, and this selection is for 'B', then it is representing 'A', and 'B', but not 'C'. But if this is a selection for 'A', then all three will match.

        Parameters:
        inf - The field to check.
        Returns:
        If the field is represented by this selection.
      • getAlias

        @Nullable
        public java.lang.String getAlias()
        Returns:
        The output field alias.
      • getField

        @Nonnull
        public net.morimekta.providence.descriptor.PField getField()
        Returns:
        The message field to be represented.
      • getArguments

        @Nullable
        public <M extends net.morimekta.providence.PMessage<M>> M getArguments()
        Type Parameters:
        M - The argument message type.
        Returns:
        The argument struct. If no arguments or params then null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object