Package io.smallrye.graphql.cdi.context
Class CDISmallRyeContext
- java.lang.Object
-
- io.smallrye.graphql.execution.context.SmallRyeContext
-
- io.smallrye.graphql.cdi.context.CDISmallRyeContext
-
- All Implemented Interfaces:
io.smallrye.graphql.api.Context
@Specializes @Priority(2147483647) public class CDISmallRyeContext extends SmallRyeContext
Class that serves as a proxy decorator for obtaining the current SmallRyeContext. It always calls SmallRyeContext.getContext() to obtain the current instance, and delegates to it. This is necessary because the SmallRyeContext is an immutable class, yet we, in some cases, need to be able to inject different instances of it during the serving of one HTTP request. This way, we make sure that an @Inject-ed SmallRyeContext is never cached and calls to it always check if there is a new context instance assigned to the current thread.
-
-
Constructor Summary
Constructors Constructor Description CDISmallRyeContext(String createdBy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtension(String key, Object value)
Map<String,Object>
getAddedExtensions()
<A> A
getArgument(String name)
<A> A
getArgumentOrDefault(String name, A defaultValue)
<A> Map<String,A>
getArguments()
graphql.schema.DataFetchingEnvironment
getDataFetchingEnvironment()
DocumentSupplier
getDocumentSupplier()
String
getExecutionId()
graphql.ExecutionInput
getExecutionInput()
io.smallrye.graphql.schema.model.Field
getField()
String
getFieldName()
Optional<String>
getOperationName()
String
getOperationType()
Optional<String>
getParentTypeName()
String
getPath()
String
getQuery()
QueryCache
getQueryCache()
jakarta.json.JsonObject
getRequest()
List<String>
getRequestedOperationTypes()
jakarta.json.JsonArray
getSelectedAndSourceFields()
jakarta.json.JsonArray
getSelectedFields()
<S> S
getSource()
Optional<Map<String,Object>>
getVariables()
<A> Boolean
hasArgument(String name)
boolean
hasOperationName()
boolean
hasRequest()
boolean
hasSource()
boolean
hasVariables()
void
setAddedExtensions(Map<String,Object> addedExtensions)
<A> void
setArguments(Map<String,A> arguments)
void
setDataFetchingEnvironment(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment)
void
setDocumentSupplier(DocumentSupplier documentSupplier)
void
setExecutionId(String executionId)
void
setExecutionInput(graphql.ExecutionInput executionInput)
void
setField(io.smallrye.graphql.schema.model.Field field)
void
setFieldName(String fieldName)
void
setOperationName(String operationName)
void
setOperationType(String operationType)
void
setParentTypeName(String parentTypeName)
void
setPath(String path)
void
setQueryCache(QueryCache queryCache)
void
setRequest(jakarta.json.JsonObject request)
void
setRequestedOperationTypes(List<String> requestedOperationTypes)
void
setSelectedAndSourceFields(jakarta.json.JsonArray selectedAndSourceFields)
void
setSelectedFields(jakarta.json.JsonArray selectedFields)
<S> void
setSource(S source)
String
toString()
<T> T
unwrap(Class<T> wrappedType)
-
Methods inherited from class io.smallrye.graphql.execution.context.SmallRyeContext
setExecutionResult
-
-
-
-
Constructor Detail
-
CDISmallRyeContext
public CDISmallRyeContext(String createdBy)
-
-
Method Detail
-
unwrap
public <T> T unwrap(Class<T> wrappedType)
- Specified by:
unwrap
in interfaceio.smallrye.graphql.api.Context
- Overrides:
unwrap
in classSmallRyeContext
-
setDocumentSupplier
public void setDocumentSupplier(DocumentSupplier documentSupplier)
- Overrides:
setDocumentSupplier
in classSmallRyeContext
-
getDocumentSupplier
public DocumentSupplier getDocumentSupplier()
- Overrides:
getDocumentSupplier
in classSmallRyeContext
-
setQueryCache
public void setQueryCache(QueryCache queryCache)
- Overrides:
setQueryCache
in classSmallRyeContext
-
getQueryCache
public QueryCache getQueryCache()
- Overrides:
getQueryCache
in classSmallRyeContext
-
setExecutionInput
public void setExecutionInput(graphql.ExecutionInput executionInput)
- Overrides:
setExecutionInput
in classSmallRyeContext
-
getExecutionInput
public graphql.ExecutionInput getExecutionInput()
- Overrides:
getExecutionInput
in classSmallRyeContext
-
setDataFetchingEnvironment
public void setDataFetchingEnvironment(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment)
- Overrides:
setDataFetchingEnvironment
in classSmallRyeContext
-
getDataFetchingEnvironment
public graphql.schema.DataFetchingEnvironment getDataFetchingEnvironment()
- Overrides:
getDataFetchingEnvironment
in classSmallRyeContext
-
setParentTypeName
public void setParentTypeName(String parentTypeName)
- Overrides:
setParentTypeName
in classSmallRyeContext
-
getParentTypeName
public Optional<String> getParentTypeName()
- Specified by:
getParentTypeName
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getParentTypeName
in classSmallRyeContext
-
setRequestedOperationTypes
public void setRequestedOperationTypes(List<String> requestedOperationTypes)
- Overrides:
setRequestedOperationTypes
in classSmallRyeContext
-
getRequestedOperationTypes
public List<String> getRequestedOperationTypes()
- Specified by:
getRequestedOperationTypes
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getRequestedOperationTypes
in classSmallRyeContext
-
setOperationType
public void setOperationType(String operationType)
- Overrides:
setOperationType
in classSmallRyeContext
-
getOperationType
public String getOperationType()
- Specified by:
getOperationType
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getOperationType
in classSmallRyeContext
-
setSelectedAndSourceFields
public void setSelectedAndSourceFields(jakarta.json.JsonArray selectedAndSourceFields)
- Overrides:
setSelectedAndSourceFields
in classSmallRyeContext
-
getSelectedAndSourceFields
public jakarta.json.JsonArray getSelectedAndSourceFields()
- Specified by:
getSelectedAndSourceFields
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getSelectedAndSourceFields
in classSmallRyeContext
-
setSelectedFields
public void setSelectedFields(jakarta.json.JsonArray selectedFields)
- Overrides:
setSelectedFields
in classSmallRyeContext
-
getSelectedFields
public jakarta.json.JsonArray getSelectedFields()
- Specified by:
getSelectedFields
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getSelectedFields
in classSmallRyeContext
-
setPath
public void setPath(String path)
- Overrides:
setPath
in classSmallRyeContext
-
getPath
public String getPath()
- Specified by:
getPath
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getPath
in classSmallRyeContext
-
setSource
public <S> void setSource(S source)
- Overrides:
setSource
in classSmallRyeContext
-
getSource
public <S> S getSource()
- Specified by:
getSource
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getSource
in classSmallRyeContext
-
setArguments
public <A> void setArguments(Map<String,A> arguments)
- Overrides:
setArguments
in classSmallRyeContext
-
getArguments
public <A> Map<String,A> getArguments()
- Specified by:
getArguments
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getArguments
in classSmallRyeContext
-
setField
public void setField(io.smallrye.graphql.schema.model.Field field)
- Overrides:
setField
in classSmallRyeContext
-
getField
public io.smallrye.graphql.schema.model.Field getField()
- Overrides:
getField
in classSmallRyeContext
-
setFieldName
public void setFieldName(String fieldName)
- Overrides:
setFieldName
in classSmallRyeContext
-
getFieldName
public String getFieldName()
- Specified by:
getFieldName
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getFieldName
in classSmallRyeContext
-
setExecutionId
public void setExecutionId(String executionId)
- Overrides:
setExecutionId
in classSmallRyeContext
-
getExecutionId
public String getExecutionId()
- Specified by:
getExecutionId
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getExecutionId
in classSmallRyeContext
-
setRequest
public void setRequest(jakarta.json.JsonObject request)
- Overrides:
setRequest
in classSmallRyeContext
-
getRequest
public jakarta.json.JsonObject getRequest()
- Specified by:
getRequest
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getRequest
in classSmallRyeContext
-
hasSource
public boolean hasSource()
-
getArgumentOrDefault
public <A> A getArgumentOrDefault(String name, A defaultValue)
-
getArgument
public <A> A getArgument(String name)
-
hasVariables
public boolean hasVariables()
-
hasOperationName
public boolean hasOperationName()
-
getOperationName
public Optional<String> getOperationName()
- Specified by:
getOperationName
in interfaceio.smallrye.graphql.api.Context
- Overrides:
getOperationName
in classSmallRyeContext
-
setOperationName
public void setOperationName(String operationName)
- Overrides:
setOperationName
in classSmallRyeContext
-
getQuery
public String getQuery()
-
hasRequest
public boolean hasRequest()
-
toString
public String toString()
- Overrides:
toString
in classSmallRyeContext
-
getAddedExtensions
public Map<String,Object> getAddedExtensions()
- Overrides:
getAddedExtensions
in classSmallRyeContext
-
setAddedExtensions
public void setAddedExtensions(Map<String,Object> addedExtensions)
- Overrides:
setAddedExtensions
in classSmallRyeContext
-
addExtension
public void addExtension(String key, Object value)
- Overrides:
addExtension
in classSmallRyeContext
-
-