Class EventTypeAwareListener<K,V>
java.lang.Object
com.github.benmanes.caffeine.jcache.event.EventTypeAwareListener<K,V>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,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 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>, Closeable
A decorator that dispatches the event iff the listener supports that action.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEventTypeAwareListener
(javax.cache.event.CacheEntryListener<? super K, ? super V> listener) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
void
void
void
-
Field Details
-
logger
-
listener
-
-
Constructor Details
-
EventTypeAwareListener
-
-
Method Details
-
isCompatible
public boolean isCompatible(@NonNull javax.cache.event.EventType eventType) Returns if the backing listener consumes this type of event. -
dispatch
Processes the event and logs if an exception is thrown. -
onCreated
-
onUpdated
-
onRemoved
-
onExpired
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-