public class MappingListenerManager<K,V> extends Object implements ListenerManager<K,V>
Modifier and Type | Method and Description |
---|---|
void |
addListener(K listener)
Add the given listener.
|
void |
addListener(K listener,
Executor executor)
Add the given listener.
|
void |
clear()
Remove all listeners
|
void |
forEach(Consumer<V> function)
Utility - apply the given function to each listener.
|
static <K,V> ListenerManager<K,V> |
mapping(Function<K,V> mapper)
Returns a new container that wraps listeners using the given mapper
|
void |
removeListener(K listener)
Remove the given listener
|
int |
size()
Return the number of listeners
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEmpty
public static <K,V> ListenerManager<K,V> mapping(Function<K,V> mapper)
mapper
- listener mapper/wrapperpublic void addListener(K listener)
Listenable
addListener
in interface Listenable<K>
listener
- listener to addpublic void addListener(K listener, Executor executor)
Listenable
addListener
in interface Listenable<K>
listener
- listener to addexecutor
- executor to run listener inpublic void removeListener(K listener)
Listenable
removeListener
in interface Listenable<K>
listener
- listener to removepublic void clear()
ListenerManager
clear
in interface ListenerManager<K,V>
public int size()
ListenerManager
size
in interface ListenerManager<K,V>
public void forEach(Consumer<V> function)
ListenerManager
forEach
in interface ListenerManager<K,V>
function
- function to call for each listenerCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.