org.eclipse.osgi.framework.eventmgr
Class EventListeners

java.lang.Object
  extended by org.eclipse.osgi.framework.eventmgr.EventListeners

public class EventListeners
extends java.lang.Object

This class manages a list of listeners. Listeners may be added or removed as necessary.

Since:
3.1

Constructor Summary
EventListeners()
          Creates a listener list with an initial capacity of 10.
EventListeners(int capacity)
          Creates a listener list with the given initial capacity.
 
Method Summary
 void addListener(java.lang.Object listener, java.lang.Object listenerObject)
          Add a listener to the list.
 void removeAllListeners()
          Remove all listeners from the list.
 void removeListener(java.lang.Object listener)
          Remove a listener from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventListeners

public EventListeners()
Creates a listener list with an initial capacity of 10.


EventListeners

public EventListeners(int capacity)
Creates a listener list with the given initial capacity.

Parameters:
capacity - The number of listeners which this list can initially accept without growing its internal representation; must be at least 1
Throws:
java.lang.IllegalArgumentException - If capacity is less than 1.
Method Detail

addListener

public void addListener(java.lang.Object listener,
                        java.lang.Object listenerObject)
Add a listener to the list. If a listener object is already in the list, then it is replaced.

Parameters:
listener - This is the listener object to be added to the list.
listenerObject - This is an optional listener-specific object. This object will be passed to the EventDispatcher along with the listener when the listener is to be called. This may be null
Throws:
java.lang.IllegalArgumentException - If listener is null.

removeListener

public void removeListener(java.lang.Object listener)
Remove a listener from the list.

Parameters:
listener - This is the listener object to be removed from the list.
Throws:
java.lang.IllegalArgumentException - If listener is null.

removeAllListeners

public void removeAllListeners()
Remove all listeners from the list.