Module org.refcodes.eventbus
Package org.refcodes.eventbus
Interface EventDispatcher<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,META extends org.refcodes.observer.EventMetaData,H>
- Type Parameters:
E
- theEvent
type.O
- The event's sourceMATCH
- theEventMatcher
type.META
- theEventMetaData
type.H
- theHandleGenerator
type.
- All Superinterfaces:
DispatchStrategyAccessor
,EventBusObservable<E,
,O, MATCH, H> EventBusPublisher<E>
,org.refcodes.component.HandleLookup<H,
,O> org.refcodes.matcher.Matchable<E>
,org.refcodes.observer.Publisher<E>
- All Known Subinterfaces:
EventBroker<EVT,
MATCH>
- All Known Implementing Classes:
AbstractEventBus
,EventBus
public interface EventDispatcher<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,META extends org.refcodes.observer.EventMetaData,H>
extends EventBusPublisher<E>, EventBusObservable<E,O,MATCH,H>, DispatchStrategyAccessor
The
EventDispatcher
is the (virtual) machine wide manager for
ActionEvent
handling.
TIPP: In order to distinguish MetaDataActionEvent
instances from each
other, create an actions enumeration, enumerating the various event actions
you support. Pass the actual action you intend to notify upon to the
according constructor, as an Observer
you may use the declarative
method EventMatcherSugar.actionEqualWith(Object)
to test whether your
action was notified (or a simple switch case statement).-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.eventbus.DispatchStrategyAccessor
DispatchStrategyAccessor.DispatchStrategyMutator, DispatchStrategyAccessor.DispatchStrategyProperty
-
Method Summary
Modifier and TypeMethodDescriptionSimilar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given name.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given name.onCatchAll
(O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes all events passing the Event-Bus.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given channel.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given channel.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.onEvent
(Class<E> aEventType, Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.onEvent
(Class<E> aEventType, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.onEvent
(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.onEvent
(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given group.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given group.Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events of the given type.onUniversalId
(Class<E> aEventType, String aUid, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given Universal-TID.onUniversalId
(String aUid, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given Universal-TID.default void
publishEvent
(E aEvent) Publishes an event using theDispatchStrategy
as returned byDispatchStrategyAccessor.getDispatchStrategy()
.void
publishEvent
(E aEvent, DispatchStrategy aDispatchStrategy) Publishes an event using the givenDispatchStrategy
.void
publishEvent
(Class<?> aPublisherType) Fires an event with the according properties.void
publishEvent
(Class<?> aPublisherType, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, Class<?> aPublisherType) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, Class<?> aPublisherType, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, String aChannel) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, String aChannel, Class<?> aPublisherType) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, String aChannel, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, META aEventMetaData) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, META aEventMetaData, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(Enum<?> aAction, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(String aChannel) Fires an event with the according properties.void
Fires an event with the according properties.void
publishEvent
(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(String aChannel, DispatchStrategy aStrategy) Fires an event with the according properties.void
publishEvent
(META aEventMetaData) Fires an event with the according properties.void
publishEvent
(META aEventMetaData, DispatchStrategy aStrategy) Fires an event with the according properties.Methods inherited from interface org.refcodes.eventbus.DispatchStrategyAccessor
getDispatchStrategy
Methods inherited from interface org.refcodes.eventbus.EventBusObservable
subscribe, subscribe, subscribe, unsubscribeAll
Methods inherited from interface org.refcodes.component.HandleLookup
hasHandle, lookupHandle, removeHandle
Methods inherited from interface org.refcodes.matcher.Matchable
isMatching
-
Method Details
-
publishEvent
Publishes an event using theDispatchStrategy
as returned byDispatchStrategyAccessor.getDispatchStrategy()
.- Specified by:
publishEvent
in interfaceorg.refcodes.observer.Publisher<E extends org.refcodes.observer.Event<?>>
-
publishEvent
Publishes an event using the givenDispatchStrategy
.- Parameters:
aEvent
- aEvent The event to be published.aDispatchStrategy
- TheDispatchStrategy
to be used when publishing the event.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.- Parameters:
aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.- Parameters:
aChannel
- The channel name on which the event is receivable.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
String onEvent(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.- Parameters:
aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.- Parameters:
aAction
- The action which this represents.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.- Parameters:
aAction
- The action which this represents.aChannel
- The channel name on which the event is receivable.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
String onEvent(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes.- Parameters:
aAction
- The action which this represents.aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aAction
- The action which this represents.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onAlias
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given name.- Parameters:
aAlias
- The name for which to subscribe.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onChannel
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given channel.- Parameters:
aChannel
- The channel to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onGroup
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given group.- Parameters:
aGroup
- The group to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onUniversalId
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given Universal-TID.- Parameters:
aUid
- The Universal-TID to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onAction
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.- Parameters:
aAction
- The action to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onActions
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.- Parameters:
aObserver
- The observer to be notified.aActions
- The actions to which to subscribe to.- Returns:
- A handle to unsubscribe this combination.
-
onCatchAll
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes all events passing the Event-Bus. Call it a "catch-all" hook.- Parameters:
aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aChannel
- The channel name on which the event is receivable.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
String onEvent(Class<E> aEventType, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aAction
- The action which this represents.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aAction
- The action which this represents.aChannel
- The channel name on which the event is receivable.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
String onEvent(Class<E> aEventType, Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, O aObserver) Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aAction
- The action which this represents.aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onEvent
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given attributes. YourObservable
may be of the required type!- Parameters:
aEventType
- The event type to subscribe for.aAction
- The action which this represents.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onType
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events of the given type. YourObservable
may be of the required type!- Type Parameters:
EVT
- The type of the event to subscribe for.- Parameters:
aEventType
- The event type to subscribe for.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onAlias
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events with the given name.- Parameters:
aEventType
- The event type to subscribe for.aName
- The name for which to subscribe.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onChannel
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given channel.- Parameters:
aEventType
- The event type to subscribe for.aChannel
- The channel to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onGroup
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given group.- Parameters:
aEventType
- The event type to subscribe for.aGroup
- The group to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onUniversalId
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given Universal-TID.- Parameters:
aEventType
- The event type to subscribe for.aUid
- The Universal-TID to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onAction
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.- Parameters:
aEventType
- The event type to subscribe for.aAction
- The action to which to subscribe to.aObserver
- The observer to be notified.- Returns:
- A handle to unsubscribe this combination.
-
onActions
Similar to the more generic methodEventBusObservable.subscribe(EventMatcher, Observer)
THOUGH subscribes for events for the given action.- Parameters:
aEventType
- The event type to subscribe for.aObserver
- The observer to be notified.aActions
- The actions to which to subscribe to.- Returns:
- A handle to unsubscribe this combination.
-
publishEvent
Fires an event with the according properties.- Parameters:
aPublisherType
- The type of the event publisher.
-
publishEvent
Fires an event with the according properties.- Parameters:
aChannel
- The channel name on which the event is receivable.
-
publishEvent
void publishEvent(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType) Fires an event with the according properties.- Parameters:
aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aPublisherType
- The type of the event publisher.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aChannel
- The channel name on which the event is receivable.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aChannel
- The channel name on which the event is receivable.aPublisherType
- The publisher type for theEventMetaData
.
-
publishEvent
void publishEvent(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType) Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.
-
publishEvent
Fires an event with the according properties.- Parameters:
aEventMetaData
- The Meta-Data to be supplied by the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aEventMetaData
- The Meta-Data to be supplied by the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.
-
publishEvent
Fires an event with the according properties.- Parameters:
aPublisherType
- The type of the event publisher.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aChannel
- The channel name on which the event is receivable.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
void publishEvent(String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, DispatchStrategy aStrategy) Fires an event with the according properties.- Parameters:
aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aPublisherType
- The type of the event publisher.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aChannel
- The channel name on which the event is receivable.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
void publishEvent(Enum<?> aAction, String aAlias, String aGroup, String aChannel, String aUid, Class<?> aPublisherType, DispatchStrategy aStrategy) Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aAlias
- The alias property.aGroup
- The group property.aChannel
- The channel property.aUid
- The UID (Universal-TID) property.aPublisherType
- The type of the event publisher.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aEventMetaData
- The Meta-Data to be supplied by the event.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aEventMetaData
- The Meta-Data to be supplied by the event.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-
publishEvent
Fires an event with the according properties.- Parameters:
aAction
- The action which this represents.aStrategy
- TheDispatchStrategy
to use when dispatching the event.
-