Class EventUtil


  • public final class EventUtil
    extends java.lang.Object
    Various static helper methods for dealing with events, notifiers and listeners.
    Author:
    Eike Stepper
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E extends IEvent>
      java.lang.AutoCloseable
      addListener​(java.lang.Object notifier, java.lang.Class<E> eventType, java.util.function.Consumer<E> eventConsumer)  
      static boolean addListener​(java.lang.Object notifier, IListener listener)  
      static boolean addUniqueListener​(java.lang.Object notifier, IListener listener)  
      static IListener[] getListeners​(java.lang.Object notifier)  
      static boolean hasListener​(java.lang.Object notifier, IListener listener)  
      static boolean removeListener​(java.lang.Object notifier, IListener listener)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_LISTENERS

        public static final IListener[] NO_LISTENERS
        Since:
        3.0
    • Method Detail

      • addUniqueListener

        public static boolean addUniqueListener​(java.lang.Object notifier,
                                                IListener listener)
        Since:
        3.2
      • addListener

        public static boolean addListener​(java.lang.Object notifier,
                                          IListener listener)
      • addListener

        public static <E extends IEvent> java.lang.AutoCloseable addListener​(java.lang.Object notifier,
                                                                             java.lang.Class<E> eventType,
                                                                             java.util.function.Consumer<E> eventConsumer)
        Since:
        3.15
      • removeListener

        public static boolean removeListener​(java.lang.Object notifier,
                                             IListener listener)
      • getListeners

        public static IListener[] getListeners​(java.lang.Object notifier)
      • hasListener

        public static boolean hasListener​(java.lang.Object notifier,
                                          IListener listener)
        Since:
        3.2