Class MultiEventHandler

  • All Implemented Interfaces:
    EventHandler

    public class MultiEventHandler
    extends Object
    implements EventHandler
    Event handler implementation that forwards a single event to multiple event handlers. This is useful since a parser only sends the event to a single handler. The event is forwarded to all registered event handlers in the order they have been registered.
    Version:
    2.15
    Author:
    Nicklas
    Last modified
    $Date: 2010-01-27 14:03:33 +0100 (on, 27 jan 2010) $
    • Constructor Detail

      • MultiEventHandler

        public MultiEventHandler()
        Create a new event handler. Use addEventHandler(EventHandler) to add the event handlers that the events should be forwarded to.
    • Method Detail

      • addEventHandler

        public void addEventHandler​(EventHandler e)
        Adds an event handler.
      • removeEventHandler

        public void removeEventHandler​(EventHandler e)
        Removes an event handler.
      • handleEvent

        public <T> void handleEvent​(EventType<T> eventType,
                                    T eventData,
                                    BfsParser parser)
        Resends the incoming event to all registered event handlers.
        Specified by:
        handleEvent in interface EventHandler
        Parameters:
        eventType - The type of event. See the parser documentation for more information about the event types it generates
        eventData - The data that is associated with the event
        parser - The parser that is resposible for parsing the file