org.xwiki.extension.event
Class AbstractExtensionEvent

java.lang.Object
  extended by org.xwiki.extension.event.AbstractExtensionEvent
All Implemented Interfaces:
ExtensionEvent, Event
Direct Known Subclasses:
ExtensionInstalledEvent, ExtensionUninstalledEvent, ExtensionUpgradedEvent

public abstract class AbstractExtensionEvent
extends Object
implements ExtensionEvent

Base class for all ExtensionEvent.

Since:
4.0M1

Constructor Summary
  AbstractExtensionEvent()
          Default constructor.
protected AbstractExtensionEvent(ExtensionId extensionId, String namespace)
           
 
Method Summary
 ExtensionId getExtensionId()
           
 String getNamespace()
           
 boolean hasNamespace()
           
 boolean matches(Object event)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractExtensionEvent

public AbstractExtensionEvent()
Default constructor.


AbstractExtensionEvent

protected AbstractExtensionEvent(ExtensionId extensionId,
                                 String namespace)
Parameters:
extensionId - the event related extension identifier
namespace - the namespace on which the event happened
Method Detail

getExtensionId

public ExtensionId getExtensionId()
Specified by:
getExtensionId in interface ExtensionEvent
Returns:
the event related extension identifier

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface ExtensionEvent
Returns:
the namespace on which the event happened, null mean root namespace

hasNamespace

public boolean hasNamespace()
Specified by:
hasNamespace in interface ExtensionEvent
Returns:
indicate of the namespace has been set in this event

matches

public boolean matches(Object event)
Description copied from interface: Event
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. 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.

Specified by:
matches in interface Event
Parameters:
event - the occuring event matched against the current object
Returns:
true if the passed event matches this event, false otherwise.