Package tigase.eventbus

# Interface EventBus

All Known Implementing Classes:
  `EventBusImplementation`

public interface EventBus

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> void`
  `addListener(Class<T> eventClass, EventListener<T> listener)`
  Adds listener of event to EventBus.
  `void`
  `addListener(String packageName, String eventName, EventListener<Element> listener)`
  Deprecated.
  `void`
  `fire(Object event)`
  Deprecated.
  `void`
  `fire(EventBusEvent event)`
  Fires event.
  `void`
  `registerAll(Object eventConsumer)`
  Register all methods annotated with `@HandleEvent` as events handlers to EventBus.
  `void`
  `registerEvent(Class<?> event, String description, boolean privateEvent)`
  `void`
  `registerEvent(String event, String description, boolean privateEvent)`
  Deprecated.
  `<T> void`
  `removeListener(EventListener<T> listener)`
  Removes listener from Eventbus.
  `void`
  `unregisterAll(Object eventConsumer)`
  Unregister all methods annotated with `@HandleEvent` as events handlers from EventBus.

- ## Method Details

  - ### addListener

    <T> void addListener(Class<T> eventClass, EventListener<T> listener)
    Adds listener of event to EventBus.
    Type Parameters:
      `T` - class of event.
    Parameters:
      `eventClass` - class of expected event.
      `listener` - listener.

  - ### addListener

    @Deprecated void addListener(String packageName, String eventName, EventListener<Element> listener)
    Deprecated.
    Adds listener of event to EventBus. If event matching to given packageName and eventName will be fired as Object (not Element), then event will be converted to XML.
    Parameters:
      `packageName` - package of event to listen.
      `eventName` - name of event to listen. May be `null`, then listener is listening for all events with specific package name.
      `listener` - listener.

  - ### fire

    @Deprecated void fire(Object event)
    Deprecated.
    Fires event.
    Parameters:
      `event` - event to fire.

  - ### fire

    void fire(EventBusEvent event)
    Fires event.
    Parameters:
      `event` - event to fire.

  - ### registerAll

    void registerAll(Object eventConsumer)
    Register all methods annotated with `@HandleEvent` as events handlers to EventBus.
    Parameters:
      `eventConsumer` - events consumer object.
    Throws:
      `RegistrationException` - if it is impossible to register all handlers method.

  - ### registerEvent

    @Deprecated void registerEvent(String event, String description, boolean privateEvent)
    Deprecated.

  - ### registerEvent

    void registerEvent(Class<?> event, String description, boolean privateEvent)

  - ### removeListener

    <T> void removeListener(EventListener<T> listener)
    Removes listener from Eventbus.
    Parameters:
      `listener` - listener to remove.

  - ### unregisterAll

    void unregisterAll(Object eventConsumer)
    Unregister all methods annotated with `@HandleEvent` as events handlers from EventBus.
    Parameters:
      `eventConsumer` - events consumer object.