Package net.sf.basedb.util.bfs
Class MultiEventHandler
java.lang.Object
net.sf.basedb.util.bfs.MultiEventHandler
- All Implemented Interfaces:
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) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an event handler.<T> void
handleEvent
(EventType<T> eventType, T eventData, BfsParser parser) Resends the incoming event to all registered event handlers.void
Removes an event handler.
-
Field Details
-
handlers
-
-
Constructor Details
-
MultiEventHandler
public MultiEventHandler()Create a new event handler. UseaddEventHandler(EventHandler)
to add the event handlers that the events should be forwarded to.
-
-
Method Details
-
addEventHandler
Adds an event handler. -
removeEventHandler
Removes an event handler. -
handleEvent
Resends the incoming event to all registered event handlers.- Specified by:
handleEvent
in interfaceEventHandler
- Parameters:
eventType
- The type of event. See the parser documentation for more information about the event types it generateseventData
- The data that is associated with the eventparser
- The parser that is resposible for parsing the file
-