Class ApplicationEvent<T extends ApplicationEventListener>
java.lang.Object
com.oorian.messaging.events.Event<T>
com.oorian.messaging.events.server.ApplicationEvent<T>
- Type Parameters:
T- the type of listener that handles this event
Abstract base class for application-wide events that are dispatched to all sessions.
Application events are broadcast across all active sessions, making them suitable for system-wide notifications such as configuration changes or shutdown warnings.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new ApplicationEvent with bubbling enabled.protectedApplicationEvent(boolean bubbles) Creates a new ApplicationEvent with the specified bubbling behavior.protectedApplicationEvent(int id) Creates a new ApplicationEvent with the specified ID.protectedApplicationEvent(int id, boolean bubbles) Creates a new ApplicationEvent with the specified ID and bubbling behavior. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch()Dispatches this event to all active sessions in the application.voiddispatchTo(T listener) Dispatches this event to the specified listener.intgetId()Returns the event identifier.
-
Constructor Details
-
ApplicationEvent
protected ApplicationEvent()Creates a new ApplicationEvent with bubbling enabled. -
ApplicationEvent
protected ApplicationEvent(boolean bubbles) Creates a new ApplicationEvent with the specified bubbling behavior.- Parameters:
bubbles-trueif this event should bubble,falseotherwise
-
ApplicationEvent
protected ApplicationEvent(int id) Creates a new ApplicationEvent with the specified ID.- Parameters:
id- the event identifier
-
ApplicationEvent
protected ApplicationEvent(int id, boolean bubbles) Creates a new ApplicationEvent with the specified ID and bubbling behavior.- Parameters:
id- the event identifierbubbles-trueif this event should bubble,falseotherwise
-
-
Method Details
-
getId
public int getId()Returns the event identifier.- Returns:
- the event ID
-
dispatch
public void dispatch()Dispatches this event to all active sessions in the application. -
dispatchTo
Dispatches this event to the specified listener.Subclasses implement this method to call the appropriate handler method on the listener interface.
- Specified by:
dispatchToin classEvent<T extends ApplicationEventListener>- Parameters:
listener- the listener to dispatch this event to
-