Class SmallRyeContext

java.lang.Object
io.smallrye.graphql.execution.context.SmallRyeContext
All Implemented Interfaces:
io.smallrye.graphql.api.Context

public class SmallRyeContext extends Object implements io.smallrye.graphql.api.Context
Implements the Context from MicroProfile API. WARNING: This class has to be used as semi-immutable. When propagating this to a new execution, it has to be cloned. A clone is a deep copy WITH THE EXCEPTION OF: - Added extensions - ExecutionResult - DataFetchingEnvironment (this actually should be rewritten after cloning for each new fetcher) These above things get shared between all clones to enable applications to write their own data into them.
Author:
Phillip Kruger (phillip.kruger@redhat.com)
  • Constructor Details

    • SmallRyeContext

      public SmallRyeContext(String createdBy)
  • Method Details

    • clone

      public SmallRyeContext clone()
      Overrides:
      clone in class Object
    • getAddedExtensions

      public Map<String,Object> getAddedExtensions()
    • addExtension

      public void addExtension(String key, Object value)
      Adds single instance of user created extension into the context.
      Parameters:
      key - The key (identification) of the extension.
      value - The value of extension.
    • getRequest

      public jakarta.json.JsonObject getRequest()
      Specified by:
      getRequest in interface io.smallrye.graphql.api.Context
    • setRequest

      public void setRequest(jakarta.json.JsonObject request)
    • getExecutionId

      public String getExecutionId()
      Specified by:
      getExecutionId in interface io.smallrye.graphql.api.Context
    • setExecutionId

      public void setExecutionId(String executionId)
    • getFieldName

      public String getFieldName()
      Specified by:
      getFieldName in interface io.smallrye.graphql.api.Context
    • setFieldName

      public void setFieldName(String fieldName)
    • getField

      public io.smallrye.graphql.schema.model.Field getField()
    • setField

      public void setField(io.smallrye.graphql.schema.model.Field field)
    • getArguments

      public <A> Map<String,A> getArguments()
      Specified by:
      getArguments in interface io.smallrye.graphql.api.Context
    • setArguments

      public <A> void setArguments(Map<String,A> arguments)
    • getSource

      public <S> S getSource()
      Specified by:
      getSource in interface io.smallrye.graphql.api.Context
    • setSource

      public <S> void setSource(S source)
    • getPath

      public String getPath()
      Specified by:
      getPath in interface io.smallrye.graphql.api.Context
    • setPath

      public void setPath(String path)
    • getSelectedFields

      public jakarta.json.JsonArray getSelectedFields()
      Specified by:
      getSelectedFields in interface io.smallrye.graphql.api.Context
    • setSelectedFields

      public void setSelectedFields(jakarta.json.JsonArray selectedFields)
    • getSelectedAndSourceFields

      public jakarta.json.JsonArray getSelectedAndSourceFields()
      Specified by:
      getSelectedAndSourceFields in interface io.smallrye.graphql.api.Context
    • setSelectedAndSourceFields

      public void setSelectedAndSourceFields(jakarta.json.JsonArray selectedAndSourceFields)
    • getOperationType

      public String getOperationType()
      Specified by:
      getOperationType in interface io.smallrye.graphql.api.Context
    • setOperationType

      public void setOperationType(String operationType)
    • getRequestedOperationTypes

      public List<String> getRequestedOperationTypes()
      Specified by:
      getRequestedOperationTypes in interface io.smallrye.graphql.api.Context
    • setRequestedOperationTypes

      public void setRequestedOperationTypes(List<String> requestedOperationTypes)
    • getParentTypeName

      public Optional<String> getParentTypeName()
      Specified by:
      getParentTypeName in interface io.smallrye.graphql.api.Context
    • setParentTypeName

      public void setParentTypeName(String parentTypeName)
    • getOperationName

      public Optional<String> getOperationName()
      Specified by:
      getOperationName in interface io.smallrye.graphql.api.Context
    • setOperationName

      public void setOperationName(String operationName)
    • getDataFetchingEnvironment

      public graphql.schema.DataFetchingEnvironment getDataFetchingEnvironment()
    • setDataFetchingEnvironment

      public void setDataFetchingEnvironment(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment)
    • getExecutionInput

      public graphql.ExecutionInput getExecutionInput()
    • setExecutionInput

      public void setExecutionInput(graphql.ExecutionInput executionInput)
    • getQueryCache

      public QueryCache getQueryCache()
    • setQueryCache

      public void setQueryCache(QueryCache queryCache)
    • getDocumentSupplier

      public DocumentSupplier getDocumentSupplier()
    • setDocumentSupplier

      public void setDocumentSupplier(DocumentSupplier documentSupplier)
    • setExecutionResult

      public void setExecutionResult(graphql.ExecutionResult executionResult)
    • unwrap

      public <T> T unwrap(Class<T> wrappedType)
      Specified by:
      unwrap in interface io.smallrye.graphql.api.Context
    • toString

      public String toString()
      Overrides:
      toString in class Object