|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.avis.util.ListenerList<E>
public class ListenerList<E>
A generic event listener list. The list is thread safe, but does not guarantee immediate visibility of changes: i.e. if thread1 executes a remove () and thread2 executes a fire () immediately after, thread2 will not necessarily see the result of the remove ().
| Constructor Summary | |
|---|---|
ListenerList(Class<E> listenerType,
String method,
Class<?>... paramTypes)
Create a new instance. |
|
ListenerList(Class<E> listenerType,
String method,
Class<?> eventType)
Create a new instance. |
|
| Method Summary | |
|---|---|
void |
add(E listener)
|
List<E> |
asList()
|
void |
fire(Object... args)
Fire an event. |
void |
fire(Object event)
Fire an event. |
boolean |
hasListeners()
Test if any listeners are in this list. |
void |
remove(E listener)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ListenerList(Class<E> listenerType,
String method,
Class<?> eventType)
throws IllegalArgumentException
listenerType - The type of the listener interface.method - The name of the method to call on the interface.eventType - The type of the single event parameter.
IllegalArgumentException - if the listener method could not
be found.
public ListenerList(Class<E> listenerType,
String method,
Class<?>... paramTypes)
throws IllegalArgumentException
listenerType - The type of the listener interface.method - The name of the method to call on the interface.paramTypes - The paramter types of the listener method.
IllegalArgumentException - if the listener method could not
be found.| Method Detail |
|---|
public List<E> asList()
public void add(E listener)
public void remove(E listener)
public void fire(Object event)
event - The event parameter.public void fire(Object... args)
args - The event parameters.public boolean hasListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||