de.novanic.eventservice.client.event.filter
Class DefaultCompositeEventFilter

java.lang.Object
  extended by de.novanic.eventservice.client.event.filter.DefaultCompositeEventFilter
All Implemented Interfaces:
AppendableEventFilter, CompositeEventFilter, EventFilter, java.io.Serializable

public class DefaultCompositeEventFilter
extends java.lang.Object
implements CompositeEventFilter

The DefaultCompositeEventFilter can handle various attached EventFilter instances. The match method calls all attached EventFilter instances to check if the Event has to be filtered.

Author:
sstrohschein
Date: 04.03.2009
Time: 20:56:07
See Also:
Serialized Form

Constructor Summary
DefaultCompositeEventFilter()
          Creates a new DefaultCompositeEventFilter.
DefaultCompositeEventFilter(EventFilter... anEventFilters)
          Creates a new DefaultCompositeEventFilter.
 
Method Summary
 AppendableEventFilter attach(EventFilter anEventFilter)
          Appends another EventFilter which is used/called from the match method (EventFilter.match(de.novanic.eventservice.client.event.Event)).
 boolean detach()
          Detaches all attached EventFilter instances.
 boolean detach(EventFilter anEventFilter)
          Detaches the attached EventFilter instances.
 java.util.List<EventFilter> getAttachedEventFilters()
          Returns the attached EventFilters.
 boolean match(Event anEvent)
          If the match method returns true for an event, the event should be ignored, because the EventFilter recognizes the event to filter it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCompositeEventFilter

public DefaultCompositeEventFilter()
Creates a new DefaultCompositeEventFilter. EventFilter instances must be attached with AppendableEventFilter.attach(EventFilter) or the constructor DefaultCompositeEventFilter(EventFilter...) must be used to register EventFilter instances for the match method.


DefaultCompositeEventFilter

public DefaultCompositeEventFilter(EventFilter... anEventFilters)
Creates a new DefaultCompositeEventFilter. The EventFilter instances are used by the match method to filter the events. More EventFilter instances can be attached with the attach method (AppendableEventFilter.attach(EventFilter)).

Parameters:
anEventFilters - EventFilter which are used by the match method
Method Detail

match

public boolean match(Event anEvent)
If the match method returns true for an event, the event should be ignored, because the EventFilter recognizes the event to filter it. The DefaultCompositeEventFilter uses the attached EventFilter instances to filter the events. See DefaultCompositeEventFilter(EventFilter...) or AppendableEventFilter.attach(EventFilter) to append EventFilter instances.

Specified by:
match in interface EventFilter
Parameters:
anEvent - event to check
Returns:
true when the event should be filtered, otherwise false

attach

public AppendableEventFilter attach(EventFilter anEventFilter)
Appends another EventFilter which is used/called from the match method (EventFilter.match(de.novanic.eventservice.client.event.Event)).

Specified by:
attach in interface AppendableEventFilter
Parameters:
anEventFilter - EventFilter to attach
Returns:
the created AppendableEventFilter (to attach more EventFilter instances)

detach

public boolean detach(EventFilter anEventFilter)
Detaches the attached EventFilter instances. EventFilter instances can be attached with AppendableEventFilter.attach(EventFilter).

Specified by:
detach in interface CompositeEventFilter
Parameters:
anEventFilter - EventFilter to detach
Returns:
true if the EventFilter was removed with that call, otherwise false

detach

public boolean detach()
Detaches all attached EventFilter instances. EventFilter instances can be attached with AppendableEventFilter.attach(EventFilter).

Specified by:
detach in interface CompositeEventFilter
Returns:
true if at least one EventFilter was removed with that call, otherwise false

getAttachedEventFilters

public java.util.List<EventFilter> getAttachedEventFilters()
Returns the attached EventFilters. EventFilter instances can be attached with AppendableEventFilter.attach(EventFilter).

Specified by:
getAttachedEventFilters in interface CompositeEventFilter
Returns:
the attached EventFilter