org.xwiki.observation.event
Class AbstractCancelableEvent

java.lang.Object
  extended by org.xwiki.observation.event.AbstractFilterableEvent
      extended by org.xwiki.observation.event.AbstractCancelableEvent
All Implemented Interfaces:
Serializable, CancelableEvent, Event, FilterableEvent
Direct Known Subclasses:
ScriptEvaluatingEvent

public abstract class AbstractCancelableEvent
extends AbstractFilterableEvent
implements CancelableEvent

Abstract base class for cancelable events.

Since:
2.5M1
See Also:
Serialized Form

Constructor Summary
protected AbstractCancelableEvent()
          Constructor initializing the event filter with an AlwaysMatchingEventFilter, meaning that this event will match any other event of the same type.
protected AbstractCancelableEvent(EventFilter eventFilter)
          Constructor using a custom EventFilter.
protected AbstractCancelableEvent(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.
 
Method Summary
 void cancel()
          Cancel the event.
 void cancel(String reason)
          Cancel the event, giving a reason why.
 String getReason()
          Get the reason why the event was canceled.
 boolean isCanceled()
          Check if this event was canceled by one of the receivers.
 
Methods inherited from class org.xwiki.observation.event.AbstractFilterableEvent
equals, getEventFilter, hashCode, matches
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.observation.event.Event
matches
 

Constructor Detail

AbstractCancelableEvent

protected AbstractCancelableEvent()
Constructor initializing the event filter with an AlwaysMatchingEventFilter, meaning that this event will match any other event of the same type.


AbstractCancelableEvent

protected AbstractCancelableEvent(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.

Parameters:
name - a generic name that uniquely identifies an event type

AbstractCancelableEvent

protected AbstractCancelableEvent(EventFilter eventFilter)
Constructor using a custom EventFilter.

Parameters:
eventFilter - the filter to use for matching events
Method Detail

isCanceled

public boolean isCanceled()
Description copied from interface: CancelableEvent
Check if this event was canceled by one of the receivers.

Specified by:
isCanceled in interface CancelableEvent
Returns:
true if the event was canceled, false otherwise

cancel

public void cancel()
Description copied from interface: CancelableEvent
Cancel the event. The actual canceling will be performed by the sender.

Specified by:
cancel in interface CancelableEvent

cancel

public void cancel(String reason)
Description copied from interface: CancelableEvent
Cancel the event, giving a reason why. The actual canceling will be performed by the sender.

Specified by:
cancel in interface CancelableEvent
Parameters:
reason - the reason why the event was canceled

getReason

public String getReason()
Description copied from interface: CancelableEvent
Get the reason why the event was canceled.

Specified by:
getReason in interface CancelableEvent
Returns:
reason for cancel or null of the event was not canceled or canceled using CancelableEvent.cancel()