Package org.apache.wicket.util.listener
Class ListenerCollection<T>
- java.lang.Object
-
- org.apache.wicket.util.listener.ListenerCollection<T>
-
- Type Parameters:
T- type of listeners
- All Implemented Interfaces:
Serializable,Iterable<T>
- Direct Known Subclasses:
ChangeListenerSet
public abstract class ListenerCollection<T> extends Object implements Serializable, Iterable<T>
Represents a collection of listeners. Facilitates invocation of events on each listener.Listeners will be invoked in the order added to the collection when using
notify(INotifier)or in reversed order when usingreversedNotify(INotifier).- Author:
- ivaynberg (Igor Vaynberg), Jonathan Locke
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceListenerCollection.INotifier<T>Used to notify a listener.
-
Constructor Summary
Constructors Constructor Description ListenerCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T listener)Adds a listener to this set of listeners.protected booleanisAllowingDuplicates()Whether or not added listeners should be checked for duplicates.protected booleanisAllowingNulls()Whether or not to allownulls in listener collection.Iterator<T>iterator()Returns an iterator that can iterate the listeners.protected voidnotify(ListenerCollection.INotifier<T> notifier)Notifies each listener in thisprotected voidnotifyIgnoringExceptions(ListenerCollection.INotifier<T> notifier)Notifies each listener in this set ignoring exceptions.voidremove(T listener)Removes a listener from this set.protected voidreversedNotify(ListenerCollection.INotifier<T> notifier)Notifies each listener in this in reversed orderprotected voidreversedNotifyIgnoringExceptions(ListenerCollection.INotifier<T> notifier)Notifies each listener in this set in reverse order ignoring exceptions-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ListenerCollection
public ListenerCollection()
-
-
Method Detail
-
add
public boolean add(T listener)
Adds a listener to this set of listeners.- Parameters:
listener- The listener to add- Returns:
trueif the listener was added
-
notify
protected void notify(ListenerCollection.INotifier<T> notifier)
Notifies each listener in this- Parameters:
notifier- notifier used to notify each listener
-
notifyIgnoringExceptions
protected void notifyIgnoringExceptions(ListenerCollection.INotifier<T> notifier)
Notifies each listener in this set ignoring exceptions. Exceptions will be logged.- Parameters:
notifier- notifier used to notify each listener
-
reversedNotifyIgnoringExceptions
protected void reversedNotifyIgnoringExceptions(ListenerCollection.INotifier<T> notifier)
Notifies each listener in this set in reverse order ignoring exceptions- Parameters:
notifier- notifier used to notify each listener
-
reversedNotify
protected void reversedNotify(ListenerCollection.INotifier<T> notifier)
Notifies each listener in this in reversed order- Parameters:
notifier- notifier used to notify each listener
-
remove
public void remove(T listener)
Removes a listener from this set.- Parameters:
listener- The listener to remove
-
isAllowingDuplicates
protected boolean isAllowingDuplicates()
Whether or not added listeners should be checked for duplicates.- Returns:
trueto ignore duplicates
-
isAllowingNulls
protected boolean isAllowingNulls()
Whether or not to allownulls in listener collection.- Returns:
- true to allow nulls to be added to the collection
-
-