Package org.xwiki.observation.event
Class AbstractFilterableEvent
- java.lang.Object
-
- org.xwiki.observation.event.AbstractFilterableEvent
-
- All Implemented Interfaces:
Serializable,Event,FilterableEvent
- Direct Known Subclasses:
AbstractCancelableEvent
public abstract class AbstractFilterableEvent extends Object implements FilterableEvent, Serializable
An helper to extend for all Events associated to a singleStringvalue.If the event value is not a
Stringextending this class should be avoided.- Since:
- 2.4M2
- Version:
- $Id: 80fd93c424a24140843a6adc84145a9e8dd1d773 $
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractFilterableEvent()Constructor initializing the event filter with anAlwaysMatchingEventFilter, meaning that this event will match any other event of the same type.AbstractFilterableEvent(String name)Constructor initializing the event filter with aFixedNameEventFilter, meaning that this event will match only events of the same type affecting the same passed name.AbstractFilterableEvent(EventFilter eventFilter)Constructor using a customEventFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)EventFiltergetEventFilter()Retrieves the filter used to match this event against other events, used inEvent.matches(Object).inthashCode()booleanmatches(Object otherEvent)Compares two events to see if they match, meaning that a listener that registered to receive notifications likereferenceEventwill be notified of any occuring event for whichreferenceEvent.matches(occuringEvent)will returntrue.
-
-
-
Constructor Detail
-
AbstractFilterableEvent
public AbstractFilterableEvent()
Constructor initializing the event filter with anAlwaysMatchingEventFilter, meaning that this event will match any other event of the same type.
-
AbstractFilterableEvent
public AbstractFilterableEvent(String name)
Constructor initializing the event filter with aFixedNameEventFilter, meaning that this event will match only events of the same type affecting the same passed name.- Parameters:
name- a generic name that uniquely identifies an event type
-
AbstractFilterableEvent
public AbstractFilterableEvent(EventFilter eventFilter)
Constructor using a customEventFilter.- Parameters:
eventFilter- the filter to use for matching events
-
-
Method Detail
-
getEventFilter
public EventFilter getEventFilter()
Description copied from interface:FilterableEventRetrieves the filter used to match this event against other events, used inEvent.matches(Object).- Specified by:
getEventFilterin interfaceFilterableEvent- Returns:
- the event's filter
-
matches
public boolean matches(Object otherEvent)
Compares two events to see if they match, meaning that a listener that registered to receive notifications likereferenceEventwill be notified of any occuring event for whichreferenceEvent.matches(occuringEvent)will returntrue. The matching algorithm depends on the event implementation. For example for Document events two events match if they implement the same event class and if theirEventFiltermatch. Note that the implementation is left open in order to cater for all the possible ways this Observation component can be used.This type of events match only events of the same type, and only if the internal
eventFilters alsoEventFilter.matches(EventFilter)match.- Specified by:
matchesin interfaceEvent- Parameters:
otherEvent- the occuring event matched against the current object- Returns:
trueif the passed event matches this event,falseotherwise.- See Also:
Event.matches(Object),EventFilter.matches(EventFilter)
-
-