public interface EventStack
Events. Before an Event is being dispatched, it is pushed onto this stack
and right after it has been dispatched to all listeners it is popped off
again. This allows queries such as which events are currently active.
Implementations must be thread safe.
| Modifier and Type | Method and Description |
|---|---|
void |
dumpStack()
Prints the current event stack to the log using SLF4j log level
debug.
|
void |
dumpStack(PrintStream out)
Prints the current event stack to the provided
PrintStream. |
boolean |
isActive(Class<? extends Listener> listenerClass)
Determines whether an Event is being dispatched for the given listener
class.
|
boolean |
isActive(Event<?,?> event)
Determines whether an Event for the same listener class as the given
one's is currently being dispatched.
|
boolean |
isAnyActive(Collection<? extends Class<? extends Listener>> c)
Determines whether an Event is being dispatched for at least one listener
class contained in the given collection.
|
Optional<Event<?,?>> |
peek()
Returns the head element of the current stack if there is any.
|
Optional<SequentialEvent<?,?>> |
preventDispatch(Class<? extends Listener> listenerClass)
Checks whether dispatch for events with the given event should be
prevented.
|
Optional<SequentialEvent<?,?>> |
preventDispatch(Event<?,?> event)
Checks whether dispatch of the given event should be prevented.
|
void dumpStack()
void dumpStack(PrintStream out)
PrintStream.out - The stream to print the log to.Optional<Event<?,?>> peek()
boolean isActive(Event<?,?> event)
event - The event to retrieve the listener class from.boolean isAnyActive(Collection<? extends Class<? extends Listener>> c)
c - Collection of listener classes.boolean isActive(Class<? extends Listener> listenerClass)
listenerClass - The listener class to check for.Optional<SequentialEvent<?,?>> preventDispatch(Event<?,?> event)
SequentialEvent currently
being dispatched, on which SequentialEvent.preventCascade(Class)
has been called with the given event's listener class.event - The event to check whether it should be prevented.EventStackHelper.checkPrevent(EventStack, Event,
java.util.function.BiConsumer, ExceptionCallback)Optional<SequentialEvent<?,?>> preventDispatch(Class<? extends Listener> listenerClass)
SequentialEvent currently being dispatched, on which
SequentialEvent.preventCascade(Class) has been called with the
given listener class.listenerClass - The listener class to check for.EventStackHelper.checkPrevent(EventStack, Event,
java.util.function.BiConsumer, ExceptionCallback)Copyright © 2014–2015. All rights reserved.