public interface

EventPublisher

com.atlassian.event.api.EventPublisher
Known Indirect Subclasses

Class Overview

Interface to publish events. It allows the decoupling of listeners which handle events and publishers which dispatch events.

Summary

Public Methods
abstract void publish(Object event)
Publish an event that will be consumed by all listeners which have registered to receive it.
abstract void register(Object listener)
Register a listener to receive events.
abstract void unregister(Object listener)
Un-register a listener so that it will no longer receive events.
abstract void unregisterAll()
Un-register all listeners that this publisher knows about.

Public Methods

public abstract void publish (Object event)

Publish an event that will be consumed by all listeners which have registered to receive it. Implementations must dispatch events to listeners which have a public method annotated with EventListener and one argument which is assignable from the event type (i.e. a superclass or interface implemented by the event object). Implementations may also dispatch events to legacy EventListener implementations based on the types returned from getHandledEventClasses(). This method should process all event listeners, despite any errors or exceptions that are generated as a result of dispatching the event.

Parameters
event the event to publish
Throws
NullPointerException if the event is null

public abstract void register (Object listener)

Register a listener to receive events. All implementations must support registration of listeners where event handling methods are indicated by the EventListener annotation. Legacy implementations may also support listeners which implement the now-deprecated EventListener interface.

Parameters
listener The listener that is being registered
Throws
NullPointerException if the listener is null
IllegalArgumentException if the parameter is not found to be an actual listener

public abstract void unregister (Object listener)

Un-register a listener so that it will no longer receive events. If the given listener is not registered nothing will happen.

Parameters
listener The listener to un-register
Throws
NullPointerException if the listener is null

public abstract void unregisterAll ()

Un-register all listeners that this publisher knows about.