Class ExecutionContext


  • @PublicApi
    public class ExecutionContext
    extends java.lang.Object
    • Method Detail

      • getFragmentsByName

        public java.util.Map<java.lang.String,​FragmentDefinition> getFragmentsByName()
      • getDocument

        public Document getDocument()
      • getVariables

        @Deprecated(since="2022-05-24")
        public java.util.Map<java.lang.String,​java.lang.Object> getVariables()
        Deprecated.
        Returns:
        map of coerced variables
      • getContext

        @Deprecated(since="2021-07-05")
        public <T> T getContext()
        Deprecated.
        Type Parameters:
        T - for two
        Returns:
        the legacy context
      • getLocalContext

        public <T> T getLocalContext()
      • getRoot

        public <T> T getRoot()
      • getDataLoaderRegistry

        public org.dataloader.DataLoaderRegistry getDataLoaderRegistry()
      • getLocale

        public java.util.Locale getLocale()
      • addError

        public void addError​(GraphQLError error,
                             ResultPath fieldPath)
        This method will only put one error per field path.
        Parameters:
        error - the error to add
        fieldPath - the field path to put it under
      • addError

        public void addError​(GraphQLError error)
        This method will allow you to add errors into the running execution context, without a check for per field unique-ness
        Parameters:
        error - the error to add
      • addErrors

        public void addErrors​(java.util.List<GraphQLError> errors)
        This method will allow you to add errors into the running execution context, without a check for per field unique-ness
        Parameters:
        errors - the errors to add
      • getErrors

        public java.util.List<GraphQLError> getErrors()
        Returns:
        the total list of errors for this execution context
      • setDataLoaderDispatcherStrategy

        public void setDataLoaderDispatcherStrategy​(DataLoaderDispatchStrategy dataLoaderDispatcherStrategy)
      • transform

        public ExecutionContext transform​(java.util.function.Consumer<ExecutionContextBuilder> builderConsumer)
        This helps you transform the current ExecutionContext object into another one by starting a builder with all the current values and allows you to transform it how you want.
        Parameters:
        builderConsumer - the consumer code that will be given a builder to transform
        Returns:
        a new ExecutionContext object based on calling build on that builder