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

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

public class DefaultEventFilter
extends java.lang.Object
implements CascadingEventFilter

Default implementation of the EventFilter interface. When no EventFilter is attached to the DefaultEventFilter, the DefaultEventFilter doesn't filter any events, because the match method returns false. An optional EventFilter instance can be attached using AppendableEventFilter.attach(EventFilter) or the constructor DefaultEventFilter(EventFilter) and is used/called by the default implementation of the match method of DefaultEventFilter. The DefaultEventFilter implements the CascadingEventFilter interface to allow to build cascading filter sequences. A CascadingEventFilter can only hold one (the next) EventFilter. See CascadingEventFilter for more information.

Author:
sstrohschein
Date: 20.07.2008
Time: 15:33:39
See Also:
Serialized Form

Constructor Summary
DefaultEventFilter()
          Creates a new DefaultEventFilter.
DefaultEventFilter(EventFilter aNextEventFilter)
          Creates a new DefaultEventFilter.
 
Method Summary
 AppendableEventFilter attach(EventFilter anEventFilter)
          Sets/Attaches another EventFilter which is used/called from the match method (EventFilter.match(de.novanic.eventservice.client.event.Event)).
 boolean detach()
          Detaches the attached EventFilter.
 EventFilter getAttachedEventFilter()
          Returns the attached EventFilter.
 boolean match(Event anEvent)
          When no EventFilter is attached to the DefaultEventFilter, no events will be filtered, because that method implementation returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventFilter

public DefaultEventFilter()
Creates a new DefaultEventFilter. An optional, appended EventFilter can be set/attached with AppendableEventFilter.attach(EventFilter) or the constructor DefaultEventFilter(EventFilter).


DefaultEventFilter

public DefaultEventFilter(EventFilter aNextEventFilter)
Creates a new DefaultEventFilter. The EventFilter is used by the default implementation of the match method (in DefaultEventFilter) to filter the events.

Parameters:
aNextEventFilter - EventFilter to attach
Method Detail

match

public boolean match(Event anEvent)
When no EventFilter is attached to the DefaultEventFilter, no events will be filtered, because that method implementation returns false. An optional EventFilter instance can be attached using AppendableEventFilter.attach(EventFilter) or the constructor DefaultEventFilter(EventFilter).

Specified by:
match in interface EventFilter
Parameters:
anEvent - event
Returns:
false or the result of the optional, attached EventFilter

attach

public AppendableEventFilter attach(EventFilter anEventFilter)
Sets/Attaches another EventFilter which is used/called from the match method (EventFilter.match(de.novanic.eventservice.client.event.Event)). A CascadingEventFilter can only hold one EventFilter.

Specified by:
attach in interface AppendableEventFilter
Parameters:
anEventFilter - EventFilter to attach/set
Returns:
itself/DefaultEventFilter (result of the attachment)

detach

public boolean detach()
Detaches the attached EventFilter. A CascadingEventFilter can only hold one EventFilter. EventFilter instances can be attached with AppendableEventFilter.attach(EventFilter).

Specified by:
detach in interface CascadingEventFilter
Returns:
true if an EventFilter was registered, otherwise false

getAttachedEventFilter

public EventFilter getAttachedEventFilter()
Returns the attached EventFilter. A CascadingEventFilter can only hold one EventFilter. EventFilter instances can be attached with AppendableEventFilter.attach(EventFilter).

Specified by:
getAttachedEventFilter in interface CascadingEventFilter
Returns:
the attached EventFilter