Package VASSAL.tools.concurrent.listener
Class DefaultMultiEventListenerSupport
java.lang.Object
VASSAL.tools.concurrent.listener.DefaultMultiEventListenerSupport
- All Implemented Interfaces:
MultiEventListenerSupport
A class to provide support for
EventListener
s.- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ConcurrentMap
<Class<?>, List<EventListener<?>>> protected final Object
-
Constructor Summary
ConstructorDescriptionCreates aDefaultMultiEventListenerSupport
. -
Method Summary
Modifier and TypeMethodDescription<T> void
addEventListener
(Class<T> c, EventListener<? super T> l) Adds anEventListener
.<T> List
<EventListener<? super T>> getEventListeners
(Class<T> c) Gets the list of listeners.boolean
hasEventListeners
(Class<?> c) Checks whether there are anyEventListener
s.void
Notify the listeners of an event.protected List
<EventListener<?>> registerType
(Class<?> c) <T> void
removeEventListener
(Class<T> c, EventListener<? super T> l) Removes anEventListener
.
-
Field Details
-
listeners
-
src
-
-
Constructor Details
-
DefaultMultiEventListenerSupport
Creates aDefaultMultiEventListenerSupport
.- Parameters:
src
- the source of events
-
-
Method Details
-
addEventListener
Adds anEventListener
.- Specified by:
addEventListener
in interfaceMultiEventListenerSupport
- Parameters:
c
- the class to listen forl
- the listener to add
-
removeEventListener
Removes anEventListener
.- Specified by:
removeEventListener
in interfaceMultiEventListenerSupport
- Parameters:
c
- the class to checkl
- the listener to remove
-
hasEventListeners
Checks whether there are anyEventListener
s.- Specified by:
hasEventListeners
in interfaceMultiEventListenerSupport
- Parameters:
c
- the class to check- Returns:
true
if there are any listeners for the given class
-
getEventListeners
Gets the list of listeners.- Specified by:
getEventListeners
in interfaceMultiEventListenerSupport
- Parameters:
c
- the class to check- Returns:
- the list of listeners for the given class
-
notify
Notify the listeners of an event.- Specified by:
notify
in interfaceMultiEventListenerSupport
- Parameters:
event
- the event to send
-
registerType
-