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

public abstract class ApplicationEvent<T extends ApplicationEventListener> extends Event<T>
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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new ApplicationEvent with bubbling enabled.
    protected
    ApplicationEvent(boolean bubbles)
    Creates a new ApplicationEvent with the specified bubbling behavior.
    protected
    Creates a new ApplicationEvent with the specified ID.
    protected
    ApplicationEvent(int id, boolean bubbles)
    Creates a new ApplicationEvent with the specified ID and bubbling behavior.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Dispatches this event to all active sessions in the application.
    void
    dispatchTo(T listener)
    Dispatches this event to the specified listener.
    int
    Returns the event identifier.

    Methods inherited from class com.oorian.messaging.events.Event

    bubbles

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 - true if this event should bubble, false otherwise
    • 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 identifier
      bubbles - true if this event should bubble, false otherwise
  • 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

      public void dispatchTo(T listener)
      Dispatches this event to the specified listener.

      Subclasses implement this method to call the appropriate handler method on the listener interface.

      Specified by:
      dispatchTo in class Event<T extends ApplicationEventListener>
      Parameters:
      listener - the listener to dispatch this event to