Package com.tick42.glue.desktop.channels
Interface ChannelContext<T>
-
- Type Parameters:
T- type of the context data
public interface ChannelContext<T>Channel context.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletionStage<?>changeChannel(String channel)Changes the current channel of this context.Optional<String>channel()Returns the current name of the channel.TgetData()Returns a snapshot of the current channel context data, ornullif there is no current channel.CompletionStage<?>publish(Map<String,Object> update)Publish update to the channel context data.CompletionStage<AsynchronousCloseable>subscribe(ChannelContextSubscriber<T> subscriber)Subscribes the specifiedsubscriberfor channel context updates.
-
-
-
Method Detail
-
channel
Optional<String> channel()
Returns the current name of the channel.When there is no current channel returned
Optionalis empty.- Returns:
- name of the channel
-
changeChannel
CompletionStage<?> changeChannel(String channel)
Changes the current channel of this context.- Parameters:
channel- name of the channel, usenullto leave the current channel- Returns:
- stage that is completed when channel is changed, never
null
-
getData
T getData()
Returns a snapshot of the current channel context data, ornullif there is no current channel.- Returns:
- current context data or
nullif no current context
-
publish
CompletionStage<?> publish(Map<String,Object> update)
Publish update to the channel context data.- Parameters:
update- data update- Returns:
- stage that is completed when update is published, never
null
-
subscribe
CompletionStage<AsynchronousCloseable> subscribe(ChannelContextSubscriber<T> subscriber)
Subscribes the specifiedsubscriberfor channel context updates.- Parameters:
subscriber- subscriber that will receive updates- Returns:
- stage that is completed when subscription is done, never
null
-
-