2.17.2: 2011-06-17

net.sf.basedb.util.bfs
Class MultiEventHandler

java.lang.Object
  extended by net.sf.basedb.util.bfs.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 (Wed, 27 Jan 2010) $

Field Summary
private  List<EventHandler> handlers
           
 
Constructor Summary
MultiEventHandler()
          Create a new event handler.
 
Method Summary
 void addEventHandler(EventHandler e)
          Adds an event handler.
<T> void
handleEvent(EventType<T> eventType, T eventData, BfsParser parser)
          Resends the incoming event to all registered event handlers.
 void removeEventHandler(EventHandler e)
          Removes an event handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handlers

private List<EventHandler> handlers
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

2.17.2: 2011-06-17