public static interface Listeners.ReadWriteListeners<K,V> extends Listeners.WriteListeners<K,V>
Entry created, modified and removed events can only be fired when these originate on a read-write functional map, since this is the only one that guarantees that the previous value has been read, and hence the differentiation between create, modified and removed can be fully guaranteed.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Listeners.ReadWriteListeners.ReadWriteListener<K,V>
Read-write listener
|
Listeners.WriteListeners.WriteListener<K,V>| Modifier and Type | Method and Description |
|---|---|
java.lang.AutoCloseable |
add(Listeners.ReadWriteListeners.ReadWriteListener<K,V> l)
Add a read-write listener, and return an
AutoCloseable
instance that can be used to remove the listener registration. |
java.lang.AutoCloseable |
onCreate(java.util.function.Consumer<EntryView.ReadEntryView<K,V>> f)
Add a create event specific listener by passing in a
Consumer to be called back each time a new cache entry is
created, passing in a EntryView.ReadEntryView of that new entry. |
java.lang.AutoCloseable |
onModify(java.util.function.BiConsumer<EntryView.ReadEntryView<K,V>,EntryView.ReadEntryView<K,V>> f)
Add a modify/update event specific listener by passing in a
BiConsumer to be called back each time an entry is
modified or updated, passing in a EntryView.ReadEntryView of the
previous entry as first parameter, and a EntryView.ReadEntryView of the
new value as second parameter. |
java.lang.AutoCloseable |
onRemove(java.util.function.Consumer<EntryView.ReadEntryView<K,V>> f)
Add a remove event specific listener by passing in a
Consumer to be called back each time an entry is
removed, passing in the EntryView.ReadEntryView of the removed entry. |
add, onWritejava.lang.AutoCloseable onCreate(java.util.function.Consumer<EntryView.ReadEntryView<K,V>> f)
Consumer to be called back each time a new cache entry is
created, passing in a EntryView.ReadEntryView of that new entry.
This method is shortcut for users who are only interested in
create events. If interested in multiple event types, calling
add(ReadWriteListener) is recommended instead.
f - operation to be called each time a new cache entry is createdAutoCloseable instance that can be used to
unregister the listenerjava.lang.AutoCloseable onModify(java.util.function.BiConsumer<EntryView.ReadEntryView<K,V>,EntryView.ReadEntryView<K,V>> f)
BiConsumer to be called back each time an entry is
modified or updated, passing in a EntryView.ReadEntryView of the
previous entry as first parameter, and a EntryView.ReadEntryView of the
new value as second parameter.
This method is shortcut for users who are only interested in
update events. If interested in multiple event types, calling
add(ReadWriteListener) is recommended instead.
f - operation to be called each time a new cache entry is modified or updated,
with the first parameter the EntryView.ReadEntryView of the previous
entry value, and the second parameter the new EntryView.ReadEntryViewAutoCloseable instance that can be used to
unregister the listenerjava.lang.AutoCloseable onRemove(java.util.function.Consumer<EntryView.ReadEntryView<K,V>> f)
Consumer to be called back each time an entry is
removed, passing in the EntryView.ReadEntryView of the removed entry.
This method is shortcut for users who are only interested in
remove events. If interested in multiple event types, calling
add(ReadWriteListener) is recommended instead.
f - operation to be called each time a new cache entry is removed,
with the old cached entry's EntryView.ReadEntryView as parameter.AutoCloseable instance that can be used to
unregister the listenerjava.lang.AutoCloseable add(Listeners.ReadWriteListeners.ReadWriteListener<K,V> l)
AutoCloseable
instance that can be used to remove the listener registration.l - the read-write functional map event listenerAutoCloseable instance that can be used to
unregister the listener