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:
AjaxRequestTargetListenerCollection
,ApplicationListenerCollection
,BehaviorInstantiationListenerCollection
,ChangeListenerSet
,ComponentInitializationListenerCollection
,ComponentInstantiationListenerCollection
,ComponentOnAfterRenderListenerCollection
,ComponentOnBeforeRenderListenerCollection
,ComponentOnConfigureListenerCollection
,HeaderContributorListenerCollection
,OnComponentTagListenerCollection
,RequestCycleListenerCollection
,SessionListenerCollection
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 using reversedNotify(INotifier)
.
- Author:
- ivaynberg (Igor Vaynberg), Jonathan Locke
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
Used to notify a listener. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a listener to this set of listeners.protected boolean
Whether or not added listeners should be checked for duplicates.protected boolean
Whether or not to allownull
s in listener collection.iterator()
Returns an iterator that can iterate the listeners.protected void
notify
(ListenerCollection.INotifier<T> notifier) Notifies each listener in thisprotected void
Notifies each listener in this set ignoring exceptions.void
Removes a listener from this set.protected void
reversedNotify
(ListenerCollection.INotifier<T> notifier) Notifies each listener in this in reversed orderprotected void
Notifies each listener in this set in reverse order ignoring exceptionsMethods 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 Details
-
ListenerCollection
public ListenerCollection()
-
-
Method Details
-
add
Adds a listener to this set of listeners.- Parameters:
listener
- The listener to add- Returns:
true
if the listener was added
-
notify
Notifies each listener in this- Parameters:
notifier
- notifier used to notify each listener
-
notifyIgnoringExceptions
Notifies each listener in this set ignoring exceptions. Exceptions will be logged.- Parameters:
notifier
- notifier used to notify each listener
-
reversedNotifyIgnoringExceptions
Notifies each listener in this set in reverse order ignoring exceptions- Parameters:
notifier
- notifier used to notify each listener
-
reversedNotify
Notifies each listener in this in reversed order- Parameters:
notifier
- notifier used to notify each listener
-
remove
Removes a listener from this set.- Parameters:
listener
- The listener to remove
-
isAllowingDuplicates
Whether or not added listeners should be checked for duplicates.- Returns:
true
to ignore duplicates
-
isAllowingNulls
Whether or not to allownull
s in listener collection.- Returns:
- true to allow nulls to be added to the collection
-
iterator
Returns an iterator that can iterate the listeners.
-