Class KeyValueFilterConverterAsCacheEventFilterConverter<K,V,C>

java.lang.Object
org.infinispan.notifications.cachelistener.filter.KeyValueFilterConverterAsCacheEventFilterConverter<K,V,C>
All Implemented Interfaces:
CacheEventConverter<K,V,C>, CacheEventFilter<K,V>, CacheEventFilterConverter<K,V,C>

public class KeyValueFilterConverterAsCacheEventFilterConverter<K,V,C> extends Object implements CacheEventFilterConverter<K,V,C>
CacheEventFilterConverter that uses an underlying KeyValueFilterConverter to do the conversion and filtering. The new value and metadata are used as arguments to the underlying filter converter as it doesn't take both new and old.
Since:
9.4
Author:
wburns
  • Constructor Details

    • KeyValueFilterConverterAsCacheEventFilterConverter

      public KeyValueFilterConverterAsCacheEventFilterConverter(KeyValueFilterConverter<K,V,C> keyValueFilterConverter)
    • KeyValueFilterConverterAsCacheEventFilterConverter

      public KeyValueFilterConverterAsCacheEventFilterConverter(KeyValueFilterConverter<K,V,C> keyValueFilterConverter, MediaType format)
  • Method Details

    • filterAndConvert

      public C filterAndConvert(K key, V oldValue, Metadata oldMetadata, V newValue, Metadata newMetadata, EventType eventType)
      Description copied from interface: CacheEventFilterConverter
      Will both filter the entry and if passed subsequently convert the value to a new value. A returned value of null will symbolize the value not passing the filter, so ensure your conversion will not return null if you want this entry to be returned.
      Specified by:
      filterAndConvert in interface CacheEventFilterConverter<K,V,C>
      Parameters:
      key - The key for the entry that was changed for the event
      oldValue - The previous value before the event takes place
      oldMetadata - The old value before the event takes place
      newValue - The new value for the entry after the event takes place
      newMetadata - The new metadata for the entry after the event takes place
      eventType - The type of event that is being raised
      Returns:
      A non null value converted value when it also passes the filter or null for when it doesn't pass the filter
    • convert

      public C convert(K key, V oldValue, Metadata oldMetadata, V newValue, Metadata newMetadata, EventType eventType)
      Description copied from interface: CacheEventConverter
      Converts the given newValue into something different possibly.
      Specified by:
      convert in interface CacheEventConverter<K,V,C>
      Parameters:
      key - The key for the entry that was changed for the event
      oldValue - The previous value before the event takes place
      oldMetadata - The old value before the event takes place
      newValue - The new value for the entry after the event takes place
      newMetadata - The new metadata for the entry after the event takes place
      eventType - The type of event that is being raised
      Returns:
      The converted value to be used in the event
    • accept

      public boolean accept(K key, V oldValue, Metadata oldMetadata, V newValue, Metadata newMetadata, EventType eventType)
      Description copied from interface: CacheEventFilter
      Whether or not this event should be raised to the listener it is attached to.
      Specified by:
      accept in interface CacheEventFilter<K,V>
      Parameters:
      key - The key for the entry that was changed for the event
      oldValue - The previous value before the event takes place
      oldMetadata - The old value before the event takes place
      newValue - The new value for the entry after the event takes place
      newMetadata - The new metadata for the entry after the event takes place
      eventType - The type of event that is being raised
      Returns:
      Whether or not to notify the listener
    • format

      public MediaType format()
      Specified by:
      format in interface CacheEventConverter<K,V,C>
      Specified by:
      format in interface CacheEventFilter<K,V>
      Specified by:
      format in interface CacheEventFilterConverter<K,V,C>
      Returns:
      The desired data format to be used in the accept operation. If null, the filter will receive data as it's stored.
    • injectDependencies

      protected void injectDependencies(ComponentRegistry cr)