public class ChainEventHandler<Event> extends java.lang.Object implements EventCollector.EventHandler<Event>
Implementation of the StreamHandler that chains registered delegates so that next filter is called
only if previous one returned true.
Since this class implements EventCollector.EventHandler - registered handlers will receive call
to the eventCollected(Object) method when this handler gets the call.
| Constructor and Description |
|---|
ChainEventHandler(java.util.Collection<java.util.function.Predicate<? super Event>> filters) |
| Modifier and Type | Method and Description |
|---|---|
void |
eventCollected(Event event)
This method is called by an
EventCollector when new captured event has passed ALL filters
and already got collected. |
boolean |
test(Event t) |
public ChainEventHandler(java.util.Collection<java.util.function.Predicate<? super Event>> filters)
public boolean test(Event t)
test in interface java.util.function.Predicate<Event>public void eventCollected(Event event)
EventCollector.EventHandlerThis method is called by an EventCollector when new captured event has passed ALL filters
and already got collected. So if this instance for an event X returns false
from the Predicate.test(Object) method - then EventCollector.EventHandler.eventCollected(Object) definitely will NOT be called
for the event X. But if this instance for an event X returns true
from the Predicate.test(Object) method - then EventCollector.EventHandler.eventCollected(Object) might be called; but
only if all the other filters registered in the same collector will also return true.
eventCollected in interface EventCollector.EventHandler<Event>