Class CapableEventEmitter<T>
java.lang.Object
com.j3d.engine.react.events.EventEmitter
com.j3d.engine.react.events.CapableEventEmitter<T>
- Type Parameters:
T- The typecapableBroadcast(EventType, EventPayload)will return and the one that is expected. in the sense that if the type returned byCapableEventListeneris the one matched by this, then the method immediately returns.
- All Implemented Interfaces:
EventEmitterInterface
- Direct Known Subclasses:
ErrorHandler
What makes this different from your generic
EventEmitter is that, this has runtime support
for CapableEventListener, which returns a value. And further returns said value via capableBroadcast(EventType, EventPayload)- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
FieldsFields inherited from class EventEmitter
registered -
Constructor Summary
ConstructorsConstructorDescriptionCapableEventEmitter(Class<T> typeToken) Instantiates a new CapableEventEmitter bound to a specific runtime type. -
Method Summary
Modifier and TypeMethodDescription<K> Pair<CapableEventListener<T>, T> capableBroadcast(EventType eventType, EventPayload<K> properties) Broadcasts an event to all registered listenersMethods inherited from class EventEmitter
attachListener, broadcast, detachAll, detachListener, genericAttach, genericBroadcast, genericDetach, genericDetachAll, isAttached
-
Field Details
-
typeToken
-
-
Constructor Details
-
CapableEventEmitter
-
-
Method Details
-
capableBroadcast
@Nullable @Contract(pure=true) public <K> Pair<CapableEventListener<T>, T> capableBroadcast(@NotNull EventType eventType, @NotNull EventPayload<K> properties) Broadcasts an event to all registered listeners- Type Parameters:
K- The object held by theEventPayload.- Parameters:
eventType- The event type.properties- Properties to pass onto the listener.- Returns:
- A pair containing the original listener and the return value by that listener, or null.
-