Class EventTypeAwareListener<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.jcache.event.EventTypeAwareListener<K,V>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.util.EventListener
,javax.cache.event.CacheEntryCreatedListener<K,V>
,javax.cache.event.CacheEntryExpiredListener<K,V>
,javax.cache.event.CacheEntryListener<K,V>
,javax.cache.event.CacheEntryRemovedListener<K,V>
,javax.cache.event.CacheEntryUpdatedListener<K,V>
final class EventTypeAwareListener<K,V> extends java.lang.Object implements javax.cache.event.CacheEntryCreatedListener<K,V>, javax.cache.event.CacheEntryUpdatedListener<K,V>, javax.cache.event.CacheEntryRemovedListener<K,V>, javax.cache.event.CacheEntryExpiredListener<K,V>, java.io.Closeable
A decorator that dispatches the event iff the listener supports that action.
-
-
Constructor Summary
Constructors Constructor Description EventTypeAwareListener(javax.cache.event.CacheEntryListener<? super K,? super V> listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
dispatch(@NonNull JCacheEntryEvent<K,V> event)
Processes the event and logs if an exception is thrown.boolean
isCompatible(@NonNull javax.cache.event.EventType eventType)
Returns if the backing listener consumes this type of event.void
onCreated(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
void
onExpired(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
void
onRemoved(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
void
onUpdated(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
-
-
-
Method Detail
-
isCompatible
public boolean isCompatible(@NonNull javax.cache.event.EventType eventType)
Returns if the backing listener consumes this type of event.
-
dispatch
public void dispatch(@NonNull JCacheEntryEvent<K,V> event)
Processes the event and logs if an exception is thrown.
-
onCreated
public void onCreated(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
-
onUpdated
public void onUpdated(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
-
onRemoved
public void onRemoved(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
-
onExpired
public void onExpired(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,? extends V>> events)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-