Package com.tick42.glue.core.contexts
Interface Context<T>
- Type Parameters:
T- type of the data
- All Superinterfaces:
AsynchronousCloseable,AutoCloseable
A shared context.
-
Method Summary
Modifier and TypeMethodDescriptionCompletionStage<? extends AsynchronousCloseable>data(ContextDataSubscriber<T> subscriber) Subscribe a specified callback for data updates.getData()The current view of the context data.default booleanisSystem()name()The name of the context.Reset context data with specified value.Update context data with specified delta.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
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
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
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
Reset context data with specified value.- Parameters:
value- new context value- Returns:
- stage that is completed when context is reset, never
null
-