org.oddjob.arooa.utils
Class ListenerSupportBase<T>
java.lang.Object
org.oddjob.arooa.utils.ListenerSupportBase<T>
- Type Parameters:
T
- The type of the listener.
- Direct Known Subclasses:
- ConfigurationOwnerSupport, ConfigurationSessionSupport
public class ListenerSupportBase<T>
- extends Object
A Helper Class for tracking Listeners. Allows commands to
be run on the first listener and when there are no more listeners.
This is useful when the events are being notified in a chain and
there is no need to subscribe when nothing is listening. For instance
in the Oddjob JMX handlers.
- Author:
- rob
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListenerSupportBase
public ListenerSupportBase()
copy
protected List<T> copy()
addListener
protected void addListener(T listener)
removeListener
protected void removeListener(T listener)
getOnFirst
public Runnable getOnFirst()
setOnFirst
public void setOnFirst(Runnable onFirst)
- Set an action to run when the first listener
is added.
- Parameters:
onFirst
-
getOnEmpty
public Runnable getOnEmpty()
setOnEmpty
public void setOnEmpty(Runnable onEmpty)
- Set an action to be run when the last listener has
been removed.
- Parameters:
onEmpty
-