public class

EventBus

extends Object
java.lang.Object
   ↳ com.neomades.event.EventBus

Class Overview

The EventBus maintains a collection of EventReceivers and an String eventType they are associated with.

Any Event can be posted, and any eventType can associate itself with an EventReceiver. Care is required in correctly managing your registered objects, you must ensure that they are unregistered when no longer needed.

Summary

Public Constructors
EventBus()
Public Methods
boolean isEnabled()
void register(String eventType, EventReceiver handler)
Registers an EventListener to an EventType
void register(EventReceiver handler)
Register an EventReceiver which would be aware about all event inside the bus
void send(Event event)
Send an event to listeners
void setEnabled(boolean enabled)
Enables or not this bus
void unregister(EventReceiver handler)
Unregisters an EventListener whatever the event type.
void unregister(String eventType, EventReceiver handler)
Unregisters an EventListener to an EventType.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public EventBus ()

Public Methods

public boolean isEnabled ()

Returns
  • true if the bus is enabled

public void register (String eventType, EventReceiver handler)

Registers an EventListener to an EventType

public void register (EventReceiver handler)

Register an EventReceiver which would be aware about all event inside the bus

public void send (Event event)

Send an event to listeners

public void setEnabled (boolean enabled)

Enables or not this bus

Parameters
enabled true to enabled

public void unregister (EventReceiver handler)

Unregisters an EventListener whatever the event type.

public void unregister (String eventType, EventReceiver handler)

Unregisters an EventListener to an EventType.