-
public interface ObjectLifecycleChangeInterface 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceObjectLifecycleChange.ListenerInterface for receiving notifications about Object lifecycle changes.
Implement this interface and register it with an ObjectLifecycleChange providerto be notified when lifecycle events occur, such as object creation or deletion.
-
Method Summary
Modifier and Type Method Description abstract ObjectsSubscriptionon(@NotNull() ObjectLifecycleEvent event, @NotNull() ObjectLifecycleChange.Listener listener)Subscribes to a specific Object lifecycle event. abstract voidoff(@NotNull() ObjectLifecycleChange.Listener listener)Unsubscribes the specified listener from all lifecycle events. abstract voidoffAll()Unsubscribes all listeners from all lifecycle events. -
-
Method Detail
-
on
@NonBlocking() abstract ObjectsSubscription on(@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 specifiedlifecycle event occurs. The returned subscription can be used tounsubscribe later when the notifications are no longer needed.
- Parameters:
event- the lifecycle event to subscribe tolistener- the listener that will be called when the event occurs
-
off
@NonBlocking() abstract void off(@NotNull() ObjectLifecycleChange.Listener listener)
Unsubscribes the specified listener from all lifecycle events.
After calling this method, the provided listener will no longer receiveany lifecycle event notifications.
- Parameters:
listener- the listener to unregister from all events
-
offAll
@NonBlocking() abstract void offAll()
Unsubscribes all listeners from all lifecycle events.
After calling this method, no listeners will receive any lifecycleevent notifications until new listeners are registered.
-
-
-
-