Class 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) javax.cache.event.CacheEntryListener<? super K,​? super V> listener  
      (package private) static java.util.logging.Logger logger  
    • 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        static final java.util.logging.Logger logger
      • listener

        final javax.cache.event.CacheEntryListener<? super K,​? super V> listener
    • Constructor Detail

      • EventTypeAwareListener

        public EventTypeAwareListener​(javax.cache.event.CacheEntryListener<? super K,​? super V> listener)
    • 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)
        Specified by:
        onCreated in interface javax.cache.event.CacheEntryCreatedListener<K,​V>
      • onUpdated

        public void onUpdated​(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,​? extends V>> events)
        Specified by:
        onUpdated in interface javax.cache.event.CacheEntryUpdatedListener<K,​V>
      • onRemoved

        public void onRemoved​(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,​? extends V>> events)
        Specified by:
        onRemoved in interface javax.cache.event.CacheEntryRemovedListener<K,​V>
      • onExpired

        public void onExpired​(java.lang.Iterable<javax.cache.event.CacheEntryEvent<? extends K,​? extends V>> events)
        Specified by:
        onExpired in interface javax.cache.event.CacheEntryExpiredListener<K,​V>
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException