net.morimekta.providence.graphql.GQLContextFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of providence-graphql Show documentation
Show all versions of providence-graphql Show documentation
Providence Core extension for GraphQL.
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;
}