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: 50a76d50345156c733765cda1f30b14526d372a0 $
-
Method Summary
Modifier and TypeMethodDescriptionProvides access to the filter's criterion.booleanmatches(EventFilter eventFilter) Compares two event filters to see if they match, meaning that the "contexts" of two events are compatible.
-
Method Details
-
getFilter
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
Compares two event filters to see if they match, meaning that the "contexts" of two events are compatible. For example, aFixedNameEventFiltermatches another filter only if they both have the same name set as the filter, while anAlwaysMatchingEventFiltermatches any other event filter. A listener that registered to receive notifications likereferenceEventand withreferenceEventFilter, will be notified of any occuring event for whichreferenceEvent.matches(occuringEvent)will returntrueandreferenceEvent.getEventFilter().matches(occurringEvent.getEventFilter()).- Parameters:
eventFilter- the event filter to compare to the filter value- Returns:
trueif both event filters match. The matching algorithm is left to the filter event implementation. For example theRegex event filterwill match another filter if that other filter matches the regex.
-