Interface KeyValuesCollectionListener

All Known Implementing Classes:
KeyValuesCollectionListener.StateAdapter

public interface KeyValuesCollectionListener
A watch listener style interface that presents a stateful KeyValuesCollection.

See KeyValuesCollectionListenerAdapter.

  • Method Details

    • onInitialState

      void onInitialState(@NotNull @NotNull HeaderResponse header, @NotNull @NotNull KeyValuesCollection state)
      Initializes the listener with the full initial state.

      Listeners that want to hold on to the state must call KeyValuesCollection.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.)

      Parameters:
      header - the header
      state - the key values state
    • onNextState

      void onNextState(@NotNull @NotNull WatchResponseUnit unit, @NotNull @NotNull KeyValuesCollection state)
      Invoked on updates.

      Listeners that want to hold on to the state must call KeyValuesCollection.asImmutable().

      Parameters:
      unit - the watch response unit
      state - the key values state AFTER applying unit changes
    • onError

      void onError(@NotNull @NotNull Throwable t)
      Invoked on errors.

      May only be called once and if called it must be the last method called.

      Parameters:
      t - the error
    • onCompleted

      void onCompleted()
      Invoked on completion.

      May only be called once and if called it must be the last method called.