Interface ObjectLifecycleChange

All Known Subinterfaces:
LiveCounter, LiveMap

public interface ObjectLifecycleChange
Interface for managing subscriptions to Object lifecycle events.

This interface provides methods to subscribe to and manage notifications about significant lifecycle changes that occur to Object, such as deletion. More events can be added in the future. Multiple listeners can be registered independently, and each can be managed separately.

Lifecycle events are different from data update events - they represent changes to the object's existence state rather than changes to the object's data content.

See Also:
  • Method Details

    • on

      @NonBlocking ObjectsSubscription on(@NotNull @NotNull ObjectLifecycleEvent event, @NotNull ObjectLifecycleChange.Listener listener)
      Subscribes to a specific Object lifecycle event.

      This method registers the provided listener to be notified when the specified lifecycle event occurs. The returned subscription can be used to unsubscribe later when the notifications are no longer needed.

      Parameters:
      event - the lifecycle event to subscribe to
      listener - the listener that will be called when the event occurs
      Returns:
      a subscription object that can be used to unsubscribe from the event
    • off

      @NonBlocking void off(@NotNull ObjectLifecycleChange.Listener listener)
      Unsubscribes the specified listener from all lifecycle events.

      After calling this method, the provided listener will no longer receive any lifecycle event notifications.

      Parameters:
      listener - the listener to unregister from all events
    • offAll

      @NonBlocking void offAll()
      Unsubscribes all listeners from all lifecycle events.

      After calling this method, no listeners will receive any lifecycle event notifications until new listeners are registered.