Interface Event<T extends EventInfo>

  • Type Parameters:
    T - type of the event information provided during event invocation.

    public interface Event<T extends EventInfo>
    Event interface, it has subscribers and could be invoked to notify subscribers only from the class where it is declared.
    • Method Detail

      • subscribe

        void subscribe​(EventHandler<T> eventHandler)
        Subscribe for the event to be notified if it is raised.
        Parameters:
        eventHandler - instance of the event handler.
      • unsubscribe

        boolean unsubscribe​(EventHandler<T> eventHandler)
        Unsubscribe from the handling the invocation of this event.
        Parameters:
        eventHandler - instance of the event handler.
        Returns:
        true if the instance of the event handler was subscribed, and it was successfully unsubscribed, false if the event handler was not among the subscribers.
      • getSubscribers

        Set<EventHandler<T>> getSubscribers()
        Getter for subscribers.
        Returns:
        set of subscribers.