org.xwiki.observation.event.filter
Interface EventFilter

All Known Implementing Classes:
AlwaysMatchingEventFilter, FixedNameEventFilter, RegexEventFilter

public interface EventFilter

Allows writing complex Event matching algorithms for the Event.matches(Object) method.

For example, this allows writing RegexEventFilter that can be used to easily match several documents at once. The following will match all Documents which are saved which have a name matching the ".*Doc.*" regex:

 new DocumentSaveEvent(new RegexEventFilter(".*Doc.*"))
 

Version:
$Id$

Method Summary
 java.lang.String getFilter()
          Provides access to the filter's criterion.
 boolean matches(EventFilter eventFilter)
          Compares two event filters to see if they match, meaning that the "contexts" of two events are compatible.
 

Method Detail

getFilter

java.lang.String getFilter()
Provides access to the filter's criterion.

Returns:
the filter used in the matches(EventFilter) method to verify if a passed event filter matches it.
See Also:
matches(EventFilter)

matches

boolean matches(EventFilter eventFilter)
Compares two event filters to see if they match, meaning that the "contexts" of two events are compatible. For example, a FixedNameEventFilter matches another filter only if they both have the same name set as the filter, while an AlwaysMatchingEventFilter matches any other event filter. A listener that registered to receive notifications like referenceEvent and with referenceEventFilter, will be notified of any occuring event for which referenceEvent.matches(occuringEvent) will return true and referenceEvent.getEventFilter().matches(occurringEvent.getEventFilter()).

Parameters:
eventFilter - the event filter to compare to the filter value
Returns:
true if both event filters match. The matching algorithm is left to the filter event implementation. For example the Regex event filter will match another filter if that other filter matches the regex.


Copyright © 2004-2011 XWiki. All Rights Reserved.