Class SmallRyeContextManager
- java.lang.Object
-
- io.smallrye.graphql.execution.context.SmallRyeContextManager
-
public class SmallRyeContextManager extends Object
Adds methods to make the life cycle of the context easy to implement- Author:
- Phillip Kruger ([email protected])
-
-
Constructor Summary
Constructors Constructor Description SmallRyeContextManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearCurrentSmallRyeContext()
static SmallRyeContext
fromInitialRequest(javax.json.JsonObject request)
This creates a new context at the beginning of the requeststatic SmallRyeContext
getCurrentSmallRyeContext()
static SmallRyeContext
populateFromDataFetchingEnvironment(Type type, Field field, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment)
This will populate the provided smallRyeContext from the GraphQL-Java DataFetchingEnvironment, and is per field.static SmallRyeContext
populateFromExecutionInput(graphql.ExecutionInput executionInput, QueryCache queryCache)
This will populate the context with the input, and happens on every new request, just before GraphQL execute is calledstatic void
restore(SmallRyeContext smallRyeContext)
static SmallRyeContext
restoreSmallRyeContext(graphql.schema.DataFetchingEnvironment dfe)
-
-
-
Field Detail
-
CONTEXT
public static final String CONTEXT
- See Also:
- Constant Field Values
-
-
Method Detail
-
restoreSmallRyeContext
public static SmallRyeContext restoreSmallRyeContext(graphql.schema.DataFetchingEnvironment dfe)
-
getCurrentSmallRyeContext
public static SmallRyeContext getCurrentSmallRyeContext()
-
restore
public static void restore(SmallRyeContext smallRyeContext)
-
clearCurrentSmallRyeContext
public static void clearCurrentSmallRyeContext()
-
fromInitialRequest
public static SmallRyeContext fromInitialRequest(javax.json.JsonObject request)
This creates a new context at the beginning of the request- Parameters:
request
- the original request- Returns:
- the initial context
-
populateFromExecutionInput
public static SmallRyeContext populateFromExecutionInput(graphql.ExecutionInput executionInput, QueryCache queryCache)
This will populate the context with the input, and happens on every new request, just before GraphQL execute is called- Parameters:
executionInput
-queryCache
-- Returns:
- the current context
-
populateFromDataFetchingEnvironment
public static SmallRyeContext populateFromDataFetchingEnvironment(Type type, Field field, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment)
This will populate the provided smallRyeContext from the GraphQL-Java DataFetchingEnvironment, and is per field.- Parameters:
type
-field
-dataFetchingEnvironment
-- Returns:
- the current context
-
-