org.xwiki.observation.event.filter
Class RegexEventFilter

java.lang.Object
  extended by org.xwiki.observation.event.filter.RegexEventFilter
All Implemented Interfaces:
java.io.Serializable, EventFilter

public class RegexEventFilter
extends java.lang.Object
implements EventFilter, java.io.Serializable

An EventFilter that selects only events whose affected document name matches a regular expression.

Version:
$Id: RegexEventFilter.java 22548 2009-08-12 10:34:51Z tmortagne $
See Also:
Serialized Form

Constructor Summary
RegexEventFilter(java.lang.String filter)
          Constructor initializing this event filter with a regular expression that should be matched.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexEventFilter

public RegexEventFilter(java.lang.String filter)
Constructor initializing this event filter with a regular expression that should be matched.

Parameters:
filter - the regular expression to check against document names
Method Detail

getFilter

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

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

matches

public 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()).

Specified by:
matches in interface EventFilter
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.
See Also:
EventFilter.getFilter()


Copyright © 2004-2011 XWiki. All Rights Reserved.