Interface IEventBusWire
- All Known Implementing Classes:
CommonAdaptingEventBusWire,CommonWirelessEventBusWire,ForgeEventBusWire
public interface IEventBusWire
Manages the wiring of an
IEventBus in order to construct a wired event bus.
The wire is essentially responsible for the association between an event bus and a platform-specific counterpart that is responsible for firing events on specific platforms. It acts as a bridge between the platform-specific event bus, if present, and the internal bus used by this implementation.
Custom implementations of this interface are allowed, although discouraged: refer to the already available implementations if possible, as a matter of cleanliness of code and implementations.
It is allowed to reuse the same wire for multiple events, provided that they can be wired the same way.
A wireless event bus can be used by using the special CommonWirelessEventBusWire wire.
- Since:
- 11.0.0
-
Method Summary
Modifier and TypeMethodDescription<T> voidregisterBusForDispatch(com.google.common.reflect.TypeToken<T> eventType, IEventBus<T> bus) Performs the necessary work to wire the givenIEventBusto its platform-specific counterpart.
-
Method Details
-
registerBusForDispatch
Performs the necessary work to wire the givenIEventBusto its platform-specific counterpart.- Type Parameters:
T- The type of the events fired in the bus.- Parameters:
eventType- The type of the events fired in the bus; this corresponds to invokingIEventBus.eventType()onbus.bus- TheIEventBusthat should be wired.- Throws:
IllegalStateException- If the given event type does not match what the wire expects. Note, however, that implementations should strive against throwing this kind of exception, rather attempting to work with as many implementations as possible.- Since:
- 11.0.0
-