Package io.deephaven.kv
Class KeyValuesCollectionListener.StateAdapter<T>
java.lang.Object
io.deephaven.kv.KeyValuesCollectionListener.StateAdapter<T>
- Type Parameters:
T- the state type
- All Implemented Interfaces:
KeyValuesCollectionListener
- Enclosing interface:
- KeyValuesCollectionListener
public static class KeyValuesCollectionListener.StateAdapter<T>
extends Object
implements KeyValuesCollectionListener
Adapts a
WatchClient.StateListener into a KeyValuesCollection.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.kv.KeyValuesCollectionListener
KeyValuesCollectionListener.StateAdapter<T> -
Constructor Summary
ConstructorsConstructorDescriptionStateAdapter(@NotNull WatchClient.StateListener<T> listener, @NotNull KeyValuesCollectionParser<Optional<T>> parser) -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked on completion.voidInvoked on errors.voidonInitialState(@NotNull HeaderResponse header, @NotNull KeyValuesCollection collection) Initializes the listener with the full initial state.voidonNextState(@NotNull WatchResponseUnit unit, @NotNull KeyValuesCollection collection) Invoked on updates.
-
Constructor Details
-
StateAdapter
public StateAdapter(@NotNull @NotNull WatchClient.StateListener<T> listener, @NotNull @NotNull KeyValuesCollectionParser<Optional<T>> parser)
-
-
Method Details
-
onInitialState
public void onInitialState(@NotNull @NotNull HeaderResponse header, @NotNull @NotNull KeyValuesCollection collection) Description copied from interface:KeyValuesCollectionListenerInitializes the listener with the full initial state.Listeners that want to hold on to the
statemust callKeyValuesCollection.asImmutable().Note: if there is an exception after this call, but before
WatchClient.Watch.startWatch()is called, the exception is *not* presented to this listener. (Todo: consider changing this.)- Specified by:
onInitialStatein interfaceKeyValuesCollectionListener- Parameters:
header- the headercollection- the key values state
-
onNextState
public void onNextState(@NotNull @NotNull WatchResponseUnit unit, @NotNull @NotNull KeyValuesCollection collection) Description copied from interface:KeyValuesCollectionListenerInvoked on updates.Listeners that want to hold on to the
statemust callKeyValuesCollection.asImmutable().- Specified by:
onNextStatein interfaceKeyValuesCollectionListener- Parameters:
unit- the watch response unitcollection- the key values state AFTER applying unit changes
-
onError
Description copied from interface:KeyValuesCollectionListenerInvoked on errors.May only be called once and if called it must be the last method called.
- Specified by:
onErrorin interfaceKeyValuesCollectionListener- Parameters:
t- the error
-
onCompleted
public void onCompleted()Description copied from interface:KeyValuesCollectionListenerInvoked on completion.May only be called once and if called it must be the last method called.
- Specified by:
onCompletedin interfaceKeyValuesCollectionListener
-