Interface EventBusObservable<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,H>

Type Parameters:
E - The Event type to be used.
O - The source to by used.
MATCH - The event matcher to be used.
H - The handle to be used.
All Superinterfaces:
org.refcodes.component.HandleLookup<H,O>
All Known Subinterfaces:
EventBroker<EVT,MATCH>, EventDispatcher<E,O,MATCH,META,H>
All Known Implementing Classes:
AbstractEventBus, EventBus

public interface EventBusObservable<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,H> extends org.refcodes.component.HandleLookup<H,O>
The Observable part of the EventDispatcher provides means to register Observer instances.

In case your EventBusObservable notifies upon events of type MetaDataActionEvent, you may use the MetaDataActionEvent and an action for distinguishing your various types of notification:

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).

  • Method Summary

    Modifier and Type
    Method
    Description
    <EVT extends E>
    H
    subscribe(Class<EVT> aEventType, MATCH aEventMatcher, org.refcodes.observer.Observer<EVT> aObserver)
    Subscribes a listener to the event bus.
    <EVT extends E>
    H
    subscribe(Class<EVT> aEventType, org.refcodes.observer.Observer<EVT> aObserver)
    Subscribes a listener to the event bus.
    subscribe(MATCH aEventMatcher, O aObserver)
    Subscribes a listener to the event bus.
    void
    unsubscribeAll(O aObserver)
    Unsubscribes all registrations to a specific listener, even if that listener is involved in several subscriptions.

    Methods inherited from interface org.refcodes.component.HandleLookup

    hasHandle, lookupHandle, removeHandle
  • Method Details

    • subscribe

      H subscribe(MATCH aEventMatcher, O aObserver)
      Subscribes a listener to the event bus. In case the handle is being ignored, use the "unsubscribeAll" method where all subscriptions for a listener are removed.
      Parameters:
      aEventMatcher - The EventMatcher to guard the Observer.
      aObserver - The Observer to subscribe.
      Returns:
      A handle to unsubscribe this combination.
    • subscribe

      <EVT extends E> H subscribe(Class<EVT> aEventType, org.refcodes.observer.Observer<EVT> aObserver)
      Subscribes a listener to the event bus. In case the handle is being ignored, use the "unsubscribeAll" method where all subscriptions for a listener are removed.
      Type Parameters:
      EVT - The type of the event to subscribe for.
      Parameters:
      aEventType - The type of event to observe.
      aObserver - The Observer to subscribe.
      Returns:
      A handle to unsubscribe this combination.
    • subscribe

      <EVT extends E> H subscribe(Class<EVT> aEventType, MATCH aEventMatcher, org.refcodes.observer.Observer<EVT> aObserver)
      Subscribes a listener to the event bus. In case the handle is being ignored, use the "unsubscribeAll" method where all subscriptions for a listener are removed.
      Type Parameters:
      EVT - The type of the event to subscribe for.
      Parameters:
      aEventType - The type of event to observe.
      aEventMatcher - The EventMatcher to guard the Observer.
      aObserver - The Observer to subscribe.
      Returns:
      A handle to unsubscribe this combination.
    • unsubscribeAll

      void unsubscribeAll(O aObserver)
      Unsubscribes all registrations to a specific listener, even if that listener is involved in several subscriptions.
      Parameters:
      aObserver - the observer