public class ListenerRegistry<Listener> extends Object
ListenerRegistry maintains a list of subscribed listeners that have expressed their interest in notifications for certain types of events.
ListenerRegistry is designed to support classes that accept listener subscriptions, such as AWT and Swing components.
ListenerRegistry is completely thread-
|Constructor and Description|
|Modifier and Type||Method and Description|
Iterates registered listeners.
Registers a listener.
Unregisters a listener.
public void registerListener(Listener iListener)
registerListener registers the given listener to receive notifications from the owner of this registry.
A listener cannot be added twice.
No action is taken if the listener is already registered.
iListener- the listener to register
public void unregisterListener(Listener iListener)
unregisterListener unregisters the given listener so that it no longer receives messages from the registry owner.
No action is taken if the listener is not registered.
Listeners should unregister themselves when they no longer need to receive messages.
iListener- the listener to unregister
iterateListeners returns an
Iterator that walks through the list of all listeners that were registered at the moment this method was invoked.
Iterator is based on a "snapshot" of this registry.)
Since the returned
Iterator exists independently from the internally stored listener list, elements may be added or removed from this registery while the iterator is still in use.
Copyright © 2013. All Rights Reserved.