net.sourceforge.hiveevents
Class FiltersChain<T>

java.lang.Object
  extended by net.sourceforge.hiveevents.FiltersChain<T>
All Implemented Interfaces:
Filter<T>

public class FiltersChain<T>
extends java.lang.Object
implements Filter<T>

Chain of event filters. Allows to daisy chain several filters (makes it easier to build complex filters).

Author:
Jean-Francois Poilpret

Constructor Summary
FiltersChain()
           
 
Method Summary
 void addFilter(Filter<T> filter)
          Add a filter at the end of the chain.
static
<T> Filter<T>
create(Filter<T>... filters)
          Create a chain of filters.
 boolean passEvent(T event)
          Checks if an event passes through ALL the filters in the chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FiltersChain

public FiltersChain()
Method Detail

create

public static <T> Filter<T> create(Filter<T>... filters)
Create a chain of filters.


addFilter

public void addFilter(Filter<T> filter)
Add a filter at the end of the chain.


passEvent

public boolean passEvent(T event)
Checks if an event passes through ALL the filters in the chain. If one only filter does not allow the event to pass, then the event will NOT pass.

Specified by:
passEvent in interface Filter<T>
Parameters:
event - the event to be checked
Returns:
true if the event must be notified to the consumer