Package com.tick42.glue.core.contexts

# Interface Context<T>

Type Parameters:
  `T` - type of the data

All Superinterfaces:
  `AsynchronousCloseable`, `AutoCloseable`

    public interface Context<T>
    extends AsynchronousCloseable

A shared context.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `CompletionStage<? extends AsynchronousCloseable>` | `data​(ContextDataSubscriber<T> subscriber)` | Subscribe a specified callback for data updates.
  `T` | `getData()` | The current view of the context data.
  `default boolean` | `isSystem()` |
  `String` | `name()` | The name of the context.
  `CompletionStage<T>` | `reset​(T value)` | Reset context data with specified value.
  `CompletionStage<?>` | `update​(Map<String,​Object> delta)` | Update context data with specified delta.
  `CompletionStage<?>` | `updatePaths​(Map<String,​Object> deltaPaths)` | Update context data with specified delta.

  ### Methods inherited from interface com.tick42.glue.core.AsynchronousCloseable

  `close, closeAsync, onClose`

- ## Method Details

  - ### name

    String name()
    The name of the context.
    Returns:
      name of the context

  - ### isSystem

    default boolean isSystem()

  - ### getData

    T getData()
    The current view of the context data.
    Returns:
      current view of the context data

  - ### data

    CompletionStage<? extends AsynchronousCloseable> data​(ContextDataSubscriber<T> subscriber)
    Subscribe a specified callback for data updates.
    Parameters:
      `subscriber` - subscriber callback
    Returns:
      stage that is completed when subscriber is ready to receive updates, never `null`

  - ### update

    CompletionStage<?> update​(Map<String,​Object> delta)
    Update context data with specified delta.
    Parameters:
      `delta` - a map with context fields to be updated/removed.
    Returns:
      stage that is completed when context is updated, never `null`
    Since:
      1.2

  - ### updatePaths

    CompletionStage<?> updatePaths​(Map<String,​Object> deltaPaths)
    Update context data with specified delta. Allows you to use "paths" in the structure to update/remove nested properties.
    Parameters:
      `deltaPaths` - a map with context paths to be updated/removed.
    Returns:
      stage that is completed when context is updated, never `null`
    Since:
      1.3.9

  - ### reset

    CompletionStage<T> reset​(T value)
    Reset context data with specified value.
    Parameters:
      `value` - new context value
    Returns:
      stage that is completed when context is reset, never `null`