RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
com.osroyale.game.event.bus.DataBus Class Reference

Public Member Functions

void subscribe (EventListener listener)
void unsubscribe (EventListener listener)
void publish (Event event)

Static Public Member Functions

static DataBus getInstance ()

Detailed Description

A Databus implementation for sending events.

The difference between a DataBus and publish/subscribe model is that. A DataBus is a form of publish/subscribe, the only difference is that the bus decouples the publisher and subscriber.

This pattern is different from the observer pattern in the sense that the observer pattern only allows for a one-to-many relationship wheres the DataBus allows for a many-to-many relationship.

EventListener's must subscribe to the bus in order to receive Event's send by the bus. EventListener's can then decide which Event's they are interested in.

See also
DataBusPattern
Author
nshusa

Definition at line 62 of file DataBus.java.

Member Function Documentation

◆ getInstance()

DataBus com.osroyale.game.event.bus.DataBus.getInstance ( )
inlinestatic

Gets the singleton object.

Definition at line 84 of file DataBus.java.

◆ publish()

void com.osroyale.game.event.bus.DataBus.publish ( Event event)
inline

Sends an Event to all subscribed listeners.

The listener's will choose which event. they are interested in.

Parameters
eventThe event that will be sent to all listeners.

Definition at line 124 of file DataBus.java.

◆ subscribe()

void com.osroyale.game.event.bus.DataBus.subscribe ( EventListener listener)
inline

Subscribes an EventListener to this bus.

If a listener is subscribed to this bus, then the listener can choose which Event's its interested in.

Parameters
listenerThe listener to subscribe to this bus.

Definition at line 97 of file DataBus.java.

◆ unsubscribe()

void com.osroyale.game.event.bus.DataBus.unsubscribe ( EventListener listener)
inline

Unsubscribe an EventListener from this bus.

If a listener is no longer subscribed to this bus then the listener will no longer receive any events sent from the bus.

Parameters
listenerThe listener to unsubscribe from this bus.

Definition at line 111 of file DataBus.java.


The documentation for this class was generated from the following file: