All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.morimekta.providence.graphql.GQLContextFactory Maven / Gradle / Ivy

There is a newer version: 2.7.0
Show newest version
package net.morimekta.providence.graphql;

import net.morimekta.providence.graphql.gql.GQLOperation;

import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletRequest;

/**
 * Create a context instance to be used in the graphql servlet.
 *
 * @param  The context implementation type.
 */
@FunctionalInterface
public interface GQLContextFactory {
    /**
     * Create a context for the given HTTP request and GQL operation.
     *
     * @param request The HTTP request.
     * @param operation The GQL operation.
     * @return The context instance.
     */
    Context createContext(@Nonnull HttpServletRequest request,
                          @Nonnull GQLOperation operation);

    /**
     * Default instance to be used when no special context is needed. The
     * default instance makes the HTTP request and the GQL operation available
     * on processor instantiation.
     */
    GQLContextFactory DEFAULT_INSTANCE = GQLContext.GQLContextImpl::new;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy