Class EventTarget<T extends Event>

  • Type Parameters:
    T - the event type to use for the target
    Direct Known Subclasses:
    Permission, PermissionManager, SessionManager

    public class EventTarget<T extends Event>
    extends java.lang.Object
    Allows object event handler registration and forwards received events to the appropriate registered event handlers.
    Since:
    1.4.0
    • Constructor Detail

      • EventTarget

        public EventTarget()
    • Method Detail

      • addEventHandler

        public final void addEventHandler​(EventType<? extends Event> eventType,
                                          EventHandler<T> eventHandler)
        Sets the specified singleton handler. There can only be one such handler specified at a time.
        Parameters:
        eventType - the event type to associate with the given eventHandler
        eventHandler - the handler to register, or null to unregister
      • removeEventHandler

        public final void removeEventHandler​(EventType<? extends T> eventType)
        Removes the singleton handler assigned to the specified Event Type.
        Parameters:
        eventType - the event type to associate with the given eventHandler
      • getEventHandler

        public final EventHandler<T> getEventHandler​(EventType<? extends T> eventType)
        Returns the singleton handler assigned to the specified Event Type.
        Parameters:
        eventType - the event type
        Returns:
        the singleton handler assigned to the specified Event Type
      • fire

        public final void fire​(Event event,
                               EventType<? extends Event> eventType)
        Fires the handle method in all registered EventHandlers.
        Parameters:
        event - the event
        eventType - the event type
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object