Interface ObjectLifecycleChange
- All Known Subinterfaces:
-
LiveCounter,LiveMap
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface for receiving notifications about Object lifecycle changes. -
Method Summary
Modifier and TypeMethodDescriptionvoidoff(ObjectLifecycleChange.Listener listener) Unsubscribes the specified listener from all lifecycle events.voidoffAll()Unsubscribes all listeners from all lifecycle events.on(@NotNull ObjectLifecycleEvent event, ObjectLifecycleChange.Listener listener) Subscribes to a specific Object lifecycle event.
-
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
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.
-