cz.cuni.amis.utils.listener
Class ListenersMap<Key>
java.lang.Object
cz.cuni.amis.utils.listener.ListenersMap<Key>
public class ListenersMap<Key>
- extends Object
Map of the listeners according to some key.
Comes in handy when you need the map of Listeners<? extends Listener> and work
with them (otherwise you're doomed to write tedious and ugly for-cycles forever).
And believe me, you don't want to parametrize the class more further the 'Key'...
... just remember it must be used with instances of 'Listener' and Java-generics are hell.
- Author:
- Jimmy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListenersMap
public ListenersMap()
getLog
public Logger getLog()
setLog
public void setLog(Logger log,
String name)
add
public void add(Key key,
IListener listener)
isListening
public boolean isListening(IListener listener)
isListening
public boolean isListening(Key key,
IListener listener)
remove
public void remove(IListener listener)
remove
public void remove(Key key,
IListener listener)
notify
public void notify(Listeners.ListenerNotifier<IListener> notifier)
notify
public void notify(Key key,
Listeners.ListenerNotifier<IListener> notifier)
notifySafe
public boolean notifySafe(Listeners.ListenerNotifier<IListener> notifier,
Logger exceptionLog)
notifySafe
public boolean notifySafe(Key key,
Listeners.ListenerNotifier<IListener> notifier,
Logger exceptionLog)
hasListeners
public boolean hasListeners()
- Notice that "hasListeners" may report true even if there are no listeners registered here (because
of weak references). But it will usually return correct value.
- Returns:
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.