tigase.jaxmpp.core.client.eventbus

## Class DefaultEventBus

- java.lang.Object
- - tigase.jaxmpp.core.client.eventbus.EventBus
  - - tigase.jaxmpp.core.client.eventbus.DefaultEventBus

- Direct Known Subclasses:
    MultiEventBus, ThreadSafeEventBus

      public class DefaultEventBus
      extends EventBus

  Basic implementation of `EventBus`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<Object,Map<Class<? extends Event<?>>,List<EventHandler>>>` | `handlers`
    `protected Logger` | `log`
    `protected boolean` | `throwingExceptionOn`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultEventBus()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<H extends EventHandler> void` | `addHandler(Class<? extends Event<H>> type, H handler)` Adds handler to receive given type of events.
    `<H extends EventHandler> void` | `addListener(Class<? extends Event<H>> type, EventListener listener)` Adds listener to receive given type of events.
    `<H extends EventHandler> void` | `addListener(EventListener listener)` Adds listener to receive all types events.
    `protected List<EventHandler>` | `createHandlersArray()`
    `protected Map<Object,Map<Class<? extends Event<?>>,List<EventHandler>>>` | `createMainHandlersMap()`
    `protected Map<Class<? extends Event<?>>,List<EventHandler>>` | `createTypeHandlersMap()`
    `protected void` | `doAdd(Class<? extends Event<?>> type, Object source, EventHandler handler)`
    `protected void` | `doFire(Event<EventHandler> event)`
    `protected void` | `doFire(Event<EventHandler> event, ArrayList<EventHandler> handlers)`
    `void` | `fire(Event<?> event)` Fires event.
    `protected Collection<EventHandler>` | `getHandlersList(Class<? extends Event<?>> type)`
    `boolean` | `isThrowingExceptionOn()`
    `void` | `remove(Class<? extends Event<?>> type, EventHandler handler)` Removes listener or handler of given type.
    `void` | `remove(EventHandler handler)` Removed listener or handler.
    `void` | `setThrowingExceptionOn(boolean throwingExceptionOn)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### handlers

          protected final Map<Object,Map<Class<? extends Event<?>>,List<EventHandler>>> handlers

    - #### log

          protected final Logger log

    - #### throwingExceptionOn

          protected boolean throwingExceptionOn

  - ### Constructor Detail

    - #### DefaultEventBus

          public DefaultEventBus()

  - ### Method Detail

    - #### addHandler

          public <H extends EventHandler> void addHandler(Class<? extends Event<H>> type,
                                                          H handler)

      Description copied from class: `EventBus`
      Adds handler to receive given type of events.
      Specified by:
        `addHandler` in class `EventBus`
      Parameters:
        `type` - type of event.
        `handler` - event handler

    - #### addListener

          public <H extends EventHandler> void addListener(Class<? extends Event<H>> type,
                                                           EventListener listener)

      Description copied from class: `EventBus`
      Adds listener to receive given type of events.
      Specified by:
        `addListener` in class `EventBus`
      Parameters:
        `type` - type of event.
        `listener` - event listener.

    - #### addListener

          public <H extends EventHandler> void addListener(EventListener listener)

      Description copied from class: `EventBus`
      Adds listener to receive all types events.
      Specified by:
        `addListener` in class `EventBus`
      Parameters:
        `listener` - event listener.

    - #### createHandlersArray

          protected List<EventHandler> createHandlersArray()

    - #### createMainHandlersMap

          protected Map<Object,Map<Class<? extends Event<?>>,List<EventHandler>>> createMainHandlersMap()

    - #### createTypeHandlersMap

          protected Map<Class<? extends Event<?>>,List<EventHandler>> createTypeHandlersMap()

    - #### doAdd

          protected void doAdd(Class<? extends Event<?>> type,
                               Object source,
                               EventHandler handler)

    - #### doFire

          protected void doFire(Event<EventHandler> event)

    - #### doFire

          protected void doFire(Event<EventHandler> event,
                                ArrayList<EventHandler> handlers)

    - #### fire

          public void fire(Event<?> event)

      Description copied from class: `EventBus`
      Fires event.
      Specified by:
        `fire` in class `EventBus`
      Parameters:
        `event` - event to fire

    - #### getHandlersList

          protected Collection<EventHandler> getHandlersList(Class<? extends Event<?>> type)

    - #### isThrowingExceptionOn

          public boolean isThrowingExceptionOn()

    - #### setThrowingExceptionOn

          public void setThrowingExceptionOn(boolean throwingExceptionOn)

    - #### remove

          public void remove(Class<? extends Event<?>> type,
                             EventHandler handler)

      Description copied from class: `EventBus`
      Removes listener or handler of given type.
      Specified by:
        `remove` in class `EventBus`
      Parameters:
        `type` - type of event.
        `handler` - handler or listener to remove from EventBus.

    - #### remove

          public void remove(EventHandler handler)

      Description copied from class: `EventBus`
      Removed listener or handler.
      Specified by:
        `remove` in class `EventBus`
      Parameters:
        `handler` - handler or listener to remove from EventBus.

Copyright © 2006–2020 Tigase. All rights reserved.