Class EventBus


  • public class EventBus
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      EventBus()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addListener​(Listener l)
      Add a listener to the EventBus
      static boolean isListenerPresent​(Listener l)
      Test if a given listener is currently registered with the EventBus
      static void publish​(Event e)
      Publish an event which will be broadcast to all listeners
      static void removeAllListeners()
      Remove all listeners from the EventBus, returning it to its initial state
      static void removeListener​(Listener l)
      Remove a listener from the EventBus
      • Methods inherited from class java.lang.Object

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

      • EventBus

        public EventBus()
    • Method Detail

      • publish

        public static void publish​(Event e)
        Publish an event which will be broadcast to all listeners
        Parameters:
        e - the event to publish
      • addListener

        public static void addListener​(Listener l)
        Add a listener to the EventBus
        Parameters:
        l - the listener to add
      • removeListener

        public static void removeListener​(Listener l)
        Remove a listener from the EventBus
        Parameters:
        l - the listener to remove. It is safe to remove a listener not currently added.
      • removeAllListeners

        public static void removeAllListeners()
        Remove all listeners from the EventBus, returning it to its initial state
      • isListenerPresent

        public static boolean isListenerPresent​(Listener l)
        Test if a given listener is currently registered with the EventBus
        Parameters:
        l - the listener to test for
        Returns:
        true if the listener is presently registered to receive events