public interface FilteringListenable<K,V> extends Listenable
Modifier and Type | Method and Description |
---|---|
<C> void |
addFilteredListener(Object listener,
CacheEventFilter<? super K,? super V> filter,
CacheEventConverter<? super K,? super V,C> converter,
Set<Class<? extends Annotation>> filterAnnotations)
Registers a listener limiting the cache-entry specific events only to
annotations that are passed in as parameter.
|
<C> void |
addListener(Object listener,
CacheEventFilter<? super K,? super V> filter,
CacheEventConverter<? super K,? super V,C> converter)
Registers a listener that will be notified on events that pass the filter condition.
|
void |
addListener(Object listener,
KeyFilter<? super K> filter)
Adds a listener to the component.
|
addListener, getListeners, removeListener
void addListener(Object listener, KeyFilter<? super K> filter)
Listener
and
further to that, contain methods annotated appropriately, otherwise the listener will not be registered.
See the Listener
annotation for more information.
listener
- must not be null.<C> void addListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter)
Some implementations may provide optimizations when a
CacheEventFilterConverter
is provided as both arguments
to the filter and converter arguments. Note the provided object must have reference equality ie. (==)
to be recognized. This allows for the filter and conversion step to take place in the same method call reducing
possible overhead.
C
- The type of the resultant value after being convertedlistener
- The listener to callback upon event notifications. Must not be null.filter
- The filter to see if the notification should be sent to the listener. Can be null.converter
- The converter to apply to the entry before being sent to the listener. Can be null.NullPointerException
- if the specified listener is null<C> void addFilteredListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
CacheEntryCreated
and CacheEntryModified
,
and filtered annotations contains only CacheEntryCreated
,
then the listener will be registered only for CacheEntryCreated
callbacks.
Callback filtering only applies to CacheEntryCreated
,
CacheEntryModified
, CacheEntryRemoved
and CacheEntryExpired
annotations.
If the listener contains other annotations, these are preserved.
This methods enables dynamic registration of listener interests at
runtime without the need to create several different listener classes.C
- The type of the resultant value after being convertedlistener
- The listener to callback upon event notifications. Must not be null.filter
- The filter to see if the notification should be sent to the listener. Can be null.converter
- The converter to apply to the entry before being sent to the listener. Can be null.filterAnnotations
- cache-entry annotations to allow listener to be registered on. Must not be null.Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.