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` | `addHandler(Class<? extends Event<H>> type, Object source, H handler)` Adds handler to receive given type of events from specified source.
    `<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(Class<? extends Event<H>> type, Object source, EventListener listener)` Adds listener to receive given type of events from specified source.
    `<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, Object source)`
    `protected void` | `doFire(Event<EventHandler> event, Object source, ArrayList<EventHandler> handlers)`
    `void` | `fire(Event<?> event)` Fires event.
    `void` | `fire(Event<?> event, Object source)` Fires event.
    `protected Collection<EventHandler>` | `getHandlersList(Class<? extends Event<?>> type, Object source)`
    `boolean` | `isThrowingExceptionOn()`
    `void` | `remove(Class<? extends Event<?>> type, EventHandler handler)` Removes listener or handler of given type.
    `void` | `remove(Class<? extends Event<?>> type, Object source, EventHandler handler)` Removes listener or handler of given type added registered to receive event from specified source.
    `void` | `remove(EventHandler handler)` Removed listener or handler.
    `void` | `setThrowingExceptionOn(boolean throwingExceptionOn)`

    - ### Methods inherited from class tigase.jaxmpp.core.client.eventbus.EventBus

      `setEventSource`

    - ### 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

    - #### addHandler

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

      Description copied from class: `EventBus`
      Adds handler to receive given type of events from specified source.
      Specified by:
        `addHandler` in class `EventBus`
      Parameters:
        `type` - type of event.
        `source` - source 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(Class<? extends Event<H>> type,
                                                           Object source,
                                                           EventListener listener)

      Description copied from class: `EventBus`
      Adds listener to receive given type of events from specified source.
      Specified by:
        `addListener` in class `EventBus`
      Parameters:
        `type` - type of event.
        `source` - source 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,
                                Object source)

    - #### doFire

          protected void doFire(Event<EventHandler> event,
                                Object source,
                                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

    - #### fire

          public void fire(Event<?> event,
                           Object source)

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

    - #### getHandlersList

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

    - #### isThrowingExceptionOn

          public boolean isThrowingExceptionOn()

    - #### 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(Class<? extends Event<?>> type,
                             Object source,
                             EventHandler handler)

      Description copied from class: `EventBus`
      Removes listener or handler of given type added registered to receive event from specified source.
      Specified by:
        `remove` in class `EventBus`
      Parameters:
        `type` - type of event.
        `source` - source 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.

    - #### setThrowingExceptionOn

          public void setThrowingExceptionOn(boolean throwingExceptionOn)

Copyright © 2006–2016 Tigase. All rights reserved.