Class GQLDefinition


  • @Immutable
    public class GQLDefinition
    extends java.lang.Object
    A GQL service is a collection of zero or more 'queries' and zero or more 'mutations'. The query and mutation distinction is meant to represent reading and writing operations, but in reality they distinguish parallel and serial execution, in case the query contains more than one base entry.
    • Constructor Summary

      Constructors 
      Constructor Description
      GQLDefinition​(net.morimekta.providence.descriptor.PService query, net.morimekta.providence.descriptor.PService mutation, java.util.Collection<net.morimekta.providence.descriptor.PField> idFields)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      net.morimekta.providence.graphql.introspection.Schema getIntrospectionSchema()
      Return the introspection schema for this definition.
      net.morimekta.providence.graphql.introspection.Type getIntrospectionType​(java.lang.String name)
      Get the introspection type for a defined type.
      net.morimekta.providence.graphql.introspection.Type getIntrospectionType​(net.morimekta.providence.descriptor.PDescriptor descriptor, boolean isInput)
      Get introspection type for a given descriptor.
      net.morimekta.providence.descriptor.PService getMutation()
      Get mutation by name, e.g. for gql queries like this:
      net.morimekta.providence.descriptor.PService getQuery()
      Get query, e.g. for gql queries like this:
      java.lang.String getSchema()
      Get a defined schema from the GQL service.
      net.morimekta.providence.descriptor.PDescriptor getType​(java.lang.String name)
      Get a type used in the GQL service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GQLDefinition

        public GQLDefinition​(@Nonnull
                             net.morimekta.providence.descriptor.PService query,
                             @Nullable
                             net.morimekta.providence.descriptor.PService mutation,
                             @Nonnull
                             java.util.Collection<net.morimekta.providence.descriptor.PField> idFields)
    • Method Detail

      • getQuery

        @Nonnull
        public net.morimekta.providence.descriptor.PService getQuery()
        Get query, e.g. for gql queries like this:
         {
             hero(id:1001) {
                 name
             }
         }
         
        Returns:
        The query service.
      • getMutation

        @Nullable
        public net.morimekta.providence.descriptor.PService getMutation()
        Get mutation by name, e.g. for gql queries like this:
         mutation HeroStore {
             deleteHero(id:1001) {
                 name
             }
         }
         
        Returns:
        The mutation service.
      • getType

        public net.morimekta.providence.descriptor.PDescriptor getType​(@Nonnull
                                                                       java.lang.String name)
        Get a type used in the GQL service.
        Parameters:
        name - The name of the type.
        Returns:
        The type description, enum or message.
      • getIntrospectionType

        @Nullable
        public net.morimekta.providence.graphql.introspection.Type getIntrospectionType​(@Nonnull
                                                                                        java.lang.String name)
        Get the introspection type for a defined type.
        Parameters:
        name - The type name.
        Returns:
        Introspection type, or null if not defined in service.
      • getIntrospectionType

        @Nonnull
        public net.morimekta.providence.graphql.introspection.Type getIntrospectionType​(@Nonnull
                                                                                        net.morimekta.providence.descriptor.PDescriptor descriptor,
                                                                                        boolean isInput)
        Get introspection type for a given descriptor.
        Parameters:
        descriptor - The descriptor to get introspection type for.
        isInput - If the type should be an input type.
        Returns:
        The introspection type.
      • getSchema

        public java.lang.String getSchema()
        Get a defined schema from the GQL service.
        Returns:
        The GQL schema.
      • getIntrospectionSchema

        @Nonnull
        public net.morimekta.providence.graphql.introspection.Schema getIntrospectionSchema()
        Return the introspection schema for this definition.
        Returns:
        The schema.