org.qi4j.library.eventsourcing.domain.source.helper
Class EventRouter

java.lang.Object
  extended by org.qi4j.library.eventsourcing.domain.source.helper.EventRouter
All Implemented Interfaces:
EventVisitor

public class EventRouter
extends Object
implements EventVisitor

Event handling router. Add specification->visitor routes. When an event comes in the router will ask each specification if it matches, and if so, delegate to the visitor and return whether it successfully handled it or not. If no routes match, returns true.


Constructor Summary
EventRouter()
           
 
Method Summary
 EventRouter route(Specification<DomainEventValue> specification, EventVisitor visitor)
           
 boolean visit(DomainEventValue eventValue)
          Route an eventValue to a visitor whose specification matches it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventRouter

public EventRouter()
Method Detail

route

public EventRouter route(Specification<DomainEventValue> specification,
                         EventVisitor visitor)

visit

public boolean visit(DomainEventValue eventValue)
Route an eventValue to a visitor whose specification matches it. If no specification matches, then return true. Otherwise return the status of the visitor that was matched.

Specified by:
visit in interface EventVisitor
Parameters:
eventValue - the eventValue
Returns:
true if eventValue was handled successfully.