RedirectedEvent instances, so they
can be easily recognized from normal direct events. If an original event
wrapped in the RedirectedEvent is consumed by any of the child
dispatchers, it won't be sent by the EventRedirector to the rest of
the original dispatch chain.
The child dispatchers can also be instances of EventRedirector and
might receive both, the normal events (from other sources) and the redirected
events from the parent EventRedirector. If a RedirectedEvent
is received, it is forwarded to the child event dispatchers without any
additional wrapping.
For this hierarchical arrangement of EventRedirector instances the
class defines the handleRedirectedEvent method, which is called with
a received redirected event, after the event has been forwarded to the child
dispatchers. By default this method is empty, but can be overridden in
derived classes to define specific handling of these redirected events.
| Modifier and Type | Field and Description |
|---|---|
| private final EventDispatchChainImpl | |
| private final List | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public | EventRedirector(final Object
the object for which to redirect the events
( eventSource)RedirectedEvent event source)Constructs a new |
| Modifier and Type | Method and Description |
|---|---|
| public final void | |
| public final Event | |
| protected void | handleRedirectedEvent(final Object
the object from which the event has been redirected eventSource, final Event the event which has been redirected event)Called when a redirected event is received by this instance. |
| private void | |
| public final void |
| eventDispatchChain | back to summary |
|---|---|
| private final EventDispatchChainImpl eventDispatchChain | |
| eventDispatchers | back to summary |
|---|---|
| private final List<EventDispatcher> eventDispatchers | |
| eventSource | back to summary |
|---|---|
| private final Object eventSource | |
| EventRedirector | back to summary |
|---|---|
| public EventRedirector(final Object eventSource) Constructs a new
| |
| addEventDispatcher | back to summary |
|---|---|
| public final void addEventDispatcher(final EventDispatcher eventDispatcher) | |
| dispatchCapturingEvent | back to summary |
|---|---|
| public final Event dispatchCapturingEvent(Event event) Overrides com.
| |
| handleRedirectedEvent | back to summary |
|---|---|
| protected void handleRedirectedEvent(final Object eventSource, final Event event) Called when a redirected event is received by this instance. | |
| redirectEvent | back to summary |
|---|---|
| private void redirectEvent(final Event event) | |
| removeEventDispatcher | back to summary |
|---|---|
| public final void removeEventDispatcher(final EventDispatcher eventDispatcher) | |