public final class StaticEventBus extends Object
SimpleEventBus that can be used when a single instance is needed and must be accessible
from everywhere (avoiding repetitive code like "StaticEventBus.getInstance()").| Modifier and Type | Method and Description |
|---|---|
static void |
addUndeliveredEventHandler(EventHandler<Object> handler) |
static void |
dispose() |
static void |
init(Dispatcher dispatcher)
Re-initializes the event bus with the specified dispatch strategy.
|
static void |
publish(Event<?> event) |
static <C> void |
publish(Topic<C> topic,
C content) |
static <C> void |
publish(Topic<C> topic,
Channel channel,
C content) |
static void |
publish(Topic<Void> topic) |
static void |
removeUndeliveredEventHandler(EventHandler<Object> handler) |
static <C> int |
subscribe(Topic<C> topic,
Channel channel,
EventFilter<? super C> filter,
EventHandler<? super C> handler) |
static <C> int |
subscribe(Topic<C> topic,
Channel channel,
EventHandler<? super C> handler) |
static <C> int |
subscribe(Topic<C> topic,
EventFilter<? super C> filter,
EventHandler<? super C> handler) |
static <C> int |
subscribe(Topic<C> topic,
EventHandler<? super C> handler) |
static void |
unsubscribe(EventHandler<?> handler)
Unsubscribes the specified event handler from all topics.
|
static void |
unsubscribe(int id) |
static void |
unsubscribe(Topic<?> topic)
Unsubscribes all event handlers for the specified topic.
|
public static void init(Dispatcher dispatcher)
dispatcher - Dispatch strategy to be used.public static void addUndeliveredEventHandler(EventHandler<Object> handler)
public static void removeUndeliveredEventHandler(EventHandler<Object> handler)
public static <C> int subscribe(Topic<C> topic, EventHandler<? super C> handler)
public static <C> int subscribe(Topic<C> topic, EventFilter<? super C> filter, EventHandler<? super C> handler)
public static <C> int subscribe(Topic<C> topic, Channel channel, EventHandler<? super C> handler)
public static <C> int subscribe(Topic<C> topic, Channel channel, EventFilter<? super C> filter, EventHandler<? super C> handler)
public static void unsubscribe(int id)
AbstractEventBus.unsubscribe(int)public static void unsubscribe(EventHandler<?> handler)
handler - Event handler to be unsubscribed from all topics.public static void unsubscribe(Topic<?> topic)
topic - Topic for which all event handlers must be unsubscribed.public static void publish(Topic<Void> topic)
AbstractEventBus.publish(Topic)public static <C> void publish(Topic<C> topic, C content)
AbstractEventBus.publish(Topic, Object)public static void publish(Event<?> event)
SimpleEventBus.publish(Event)public static void dispose()
SimpleEventBus.dispose()Copyright © 2017. All rights reserved.