Package VASSAL.tools.concurrent.listener
Class DefaultMultiEventListenerSupport
java.lang.Object
VASSAL.tools.concurrent.listener.DefaultMultiEventListenerSupport
- All Implemented Interfaces:
MultiEventListenerSupport
public class DefaultMultiEventListenerSupport extends Object implements MultiEventListenerSupport
A class to provide support for
EventListeners.- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentMap<Class<?>,List<EventListener<?>>>listenersprotected Objectsrc -
Constructor Summary
Constructors Constructor Description DefaultMultiEventListenerSupport(Object src)Creates aDefaultMultiEventListenerSupport. -
Method Summary
Modifier and Type Method Description <T> voidaddEventListener(Class<T> c, EventListener<? super T> l)Adds anEventListener.<T> List<EventListener<? super T>>getEventListeners(Class<T> c)Gets the list of listerners.booleanhasEventListeners(Class<?> c)Checks whether there are anyEventListeners.voidnotify(Object event)Notify the listeners of an event.protected List<EventListener<?>>registerType(Class<?> c)<T> voidremoveEventListener(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:
addEventListenerin interfaceMultiEventListenerSupport- Parameters:
c- the class to listen forl- the listener to add
-
removeEventListener
Removes anEventListener.- Specified by:
removeEventListenerin interfaceMultiEventListenerSupport- Parameters:
c- the class to checkl- the listener to remove
-
hasEventListeners
Checks whether there are anyEventListeners.- Specified by:
hasEventListenersin interfaceMultiEventListenerSupport- Parameters:
c- the class to check- Returns:
trueif there are any listeners for the given class
-
getEventListeners
Gets the list of listerners.- Specified by:
getEventListenersin 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:
notifyin interfaceMultiEventListenerSupport- Parameters:
event- the event to send
-
registerType
-