public abstract class AbstractFilterableEvent extends Object implements FilterableEvent, Serializable
String
value.
If the event value is not a String
extending this class should be avoided.
Constructor and Description |
---|
AbstractFilterableEvent()
Constructor initializing the event filter with an
AlwaysMatchingEventFilter , meaning that this event will match any
other event of the same type. |
AbstractFilterableEvent(EventFilter eventFilter)
Constructor using a custom
EventFilter . |
AbstractFilterableEvent(String name)
Constructor initializing the event filter with a
FixedNameEventFilter ,
meaning that this event will match only events of the same type affecting the same passed name. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
EventFilter |
getEventFilter()
Retrieves the filter used to match this event against other events, used in
Event.matches(Object) . |
int |
hashCode() |
boolean |
matches(Object otherEvent)
Compares two events to see if they match, meaning that a listener that registered to receive
notifications like
referenceEvent will be notified of any occuring event for which
referenceEvent.matches(occuringEvent) will return true . |
public AbstractFilterableEvent()
AlwaysMatchingEventFilter
, meaning that this event will match any
other event of the same type.public AbstractFilterableEvent(String name)
FixedNameEventFilter
,
meaning that this event will match only events of the same type affecting the same passed name.name
- a generic name that uniquely identifies an event typepublic AbstractFilterableEvent(EventFilter eventFilter)
EventFilter
.eventFilter
- the filter to use for matching eventspublic EventFilter getEventFilter()
FilterableEvent
Event.matches(Object)
.getEventFilter
in interface FilterableEvent
public boolean matches(Object otherEvent)
referenceEvent
will be notified of any occuring event for which
referenceEvent.matches(occuringEvent)
will return true
. 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 their EventFilter
match. 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 eventFilter
s also
EventFilter.matches(EventFilter)
match.
matches
in interface Event
otherEvent
- the occuring event matched against the current objecttrue
if the passed event matches this event, false
otherwise.Event.matches(Object)
,
EventFilter.matches(EventFilter)
Copyright © 2004–2021 XWiki. All rights reserved.