Class Event<EVENT_DATA>

java.lang.Object
org.teamapps.event.Event<EVENT_DATA>
Type Parameters:
EVENT_DATA - The type of data this event fires.
Direct Known Subclasses:
DecoupledEvent

public class Event<EVENT_DATA>
extends java.lang.Object
Represents an event that can get fired.

Listeners can be added to this event using the various addListener(...) methods.

SessionContext-bound Event Listeners

Note that if a listener is added while the thread is bound to a SessionContext A (so while SessionContext.currentOrNull() is not null), the event will be bound to this SessionContext (A) by default, i.e.:
  • When this event fires, the SessionContext-bound listener will get invoked bound to the SessionContext A, regardless of the SessionContext (or the lack of it) the event was fired in.
  • When the SessionContext A is destroyed (and thereby fires its SessionContext.onDestroyed event), the listener is automatically detached from this event.
You can prevent a listener from being bound to the current SessionContext, by using one of the addListener(..., boolean bindToSessionContext) methods.