Class ContextSnapshotFactoryHelper

java.lang.Object
org.springframework.graphql.execution.ContextSnapshotFactoryHelper

public abstract class ContextSnapshotFactoryHelper extends Object
Helper to use a single ContextSnapshotFactory instance by saving and obtaining it to and from Reactor and GraphQL contexts.
Since:
1.3.0
Author:
Rossen Stoyanchev
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.micrometer.context.ContextSnapshot
    Shortcut to obtain the ContextSnapshotFactory instance, and to capture from the given GraphQLContext.
    static io.micrometer.context.ContextSnapshot
    captureFrom(reactor.util.context.ContextView contextView)
    Shortcut to obtain the ContextSnapshotFactory instance, and to capture from the given ContextView.
    static io.micrometer.context.ContextSnapshotFactory
    Access the ContextSnapshotFactory from the given GraphQLContext or return a shared, static instance.
    static io.micrometer.context.ContextSnapshotFactory
    getInstance(reactor.util.context.ContextView contextView)
    Access the ContextSnapshotFactory from the given ContextView or return a shared, static instance.
    static void
    saveInstance(io.micrometer.context.ContextSnapshotFactory factory, GraphQLContext context)
    Save the ContextSnapshotFactory in the given Context.
    static reactor.util.context.Context
    saveInstance(io.micrometer.context.ContextSnapshotFactory factory, reactor.util.context.Context context)
    Save the ContextSnapshotFactory in the given Context.
    static io.micrometer.context.ContextSnapshotFactory
    selectInstance(io.micrometer.context.ContextSnapshotFactory factory)
    Select a ContextSnapshotFactory instance to use, either the one passed in if it is not null, or a shared, static instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ContextSnapshotFactoryHelper

      public ContextSnapshotFactoryHelper()
  • Method Details

    • selectInstance

      public static io.micrometer.context.ContextSnapshotFactory selectInstance(@Nullable io.micrometer.context.ContextSnapshotFactory factory)
      Select a ContextSnapshotFactory instance to use, either the one passed in if it is not null, or a shared, static instance.
      Parameters:
      factory - the candidate factory instance to use if not null
      Returns:
      the instance to use
    • saveInstance

      public static reactor.util.context.Context saveInstance(io.micrometer.context.ContextSnapshotFactory factory, reactor.util.context.Context context)
      Save the ContextSnapshotFactory in the given Context.
      Parameters:
      factory - the instance to save
      context - the context to save the instance to
      Returns:
      a new context with the saved instance
    • saveInstance

      public static void saveInstance(io.micrometer.context.ContextSnapshotFactory factory, GraphQLContext context)
      Save the ContextSnapshotFactory in the given Context.
      Parameters:
      factory - the instance to save
      context - the context to save the instance to
    • getInstance

      public static io.micrometer.context.ContextSnapshotFactory getInstance(reactor.util.context.ContextView contextView)
      Access the ContextSnapshotFactory from the given ContextView or return a shared, static instance.
      Parameters:
      contextView - the context where the instance is saved
      Returns:
      the instance to use
    • getInstance

      public static io.micrometer.context.ContextSnapshotFactory getInstance(GraphQLContext context)
      Access the ContextSnapshotFactory from the given GraphQLContext or return a shared, static instance.
      Parameters:
      context - the context where the instance is saved
      Returns:
      the instance to use
    • captureFrom

      public static io.micrometer.context.ContextSnapshot captureFrom(reactor.util.context.ContextView contextView)
      Shortcut to obtain the ContextSnapshotFactory instance, and to capture from the given ContextView.
      Parameters:
      contextView - the context to capture from
      Returns:
      a snapshot from the capture
    • captureFrom

      public static io.micrometer.context.ContextSnapshot captureFrom(GraphQLContext context)
      Shortcut to obtain the ContextSnapshotFactory instance, and to capture from the given GraphQLContext.
      Parameters:
      context - the context to capture from
      Returns:
      a snapshot from the capture