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 Detail

      • GQLDefinition

        @Deprecated
        public GQLDefinition​(@Nonnull
                             PService query,
                             @Nullable
                             PService mutation,
                             @Nonnull
                             java.util.Collection<PField<?>> idFields)
        Deprecated.
        Use Builder.
        Create a graphql definition instance.
        Parameters:
        query - The query service. Mandatory.
        mutation - The mutation service.
        idFields - Collection if ID fields.
      • GQLDefinition

        @Deprecated
        public GQLDefinition​(@Nonnull
                             PService query,
                             @Nullable
                             PService mutation,
                             @Nonnull
                             java.util.Collection<PField<?>> idFields,
                             @Nonnull
                             java.util.Collection<PUnionDescriptor<?>> asInterface)
        Deprecated.
        Use Builder.
        Create a graphql definition instance.
        Parameters:
        query - The query service. Mandatory.
        mutation - The mutation service.
        idFields - Collection if ID fields.
        asInterface - Collection of unions to be
    • Method Detail

      • getQuery

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

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

        public boolean isIgnoredField​(PField<?> field)
        If the field should be ignored. This means not allowed in fragments or selection sets.
        Parameters:
        field - The field to check.
        Returns:
        True if the field should be ignored.
      • isIgnoredType

        public boolean isIgnoredType​(PDescriptor descriptor)
        If the type should be ignored.
        Parameters:
        descriptor - The type
        Returns:
        If the type should be ignored.
      • getType

        public 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
                                                                                        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.