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. The old value is not returned in any event.- Since:
- 9.4
- Author:
- wburns
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Constructor Summary
ConstructorDescriptionKeyValueFilterConverterAsCacheEventFilterConverter
(KeyValueFilterConverter<K, V, C> keyValueFilterConverter) KeyValueFilterConverterAsCacheEventFilterConverter
(KeyValueFilterConverter<K, V, C> keyValueFilterConverter, MediaType format) -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(K key, V oldValue, Metadata oldMetadata, V newValue, Metadata newMetadata, EventType eventType) Whether or not this event should be raised to the listener it is attached to.convert
(K key, V oldValue, Metadata oldMetadata, V newValue, Metadata newMetadata, EventType eventType) Converts the given newValue into something different possibly.filterAndConvert
(K key, V oldValue, Metadata oldMetadata, V newValue, Metadata newMetadata, EventType eventType) Will both filter the entry and if passed subsequently convert the value to a new value.format()
boolean
Whether the old value should be returned in the event with the converted value.protected void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.notifications.cachelistener.filter.CacheEventConverter
useRequestFormat
-
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 ofnull
will symbolize the value not passing the filter, so ensure your conversion will not returnnull
if you want this entry to be returned.- Specified by:
filterAndConvert
in interfaceCacheEventFilterConverter<K,
V, C> - Parameters:
key
- The key for the entry that was changed for the eventoldValue
- The previous value before the event takes placeoldMetadata
- The old value before the event takes placenewValue
- The new value for the entry after the event takes placenewMetadata
- The new metadata for the entry after the event takes placeeventType
- The type of event that is being raised- Returns:
- A non
null
value converted value when it also passes the filter ornull
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 interfaceCacheEventConverter<K,
V, C> - Parameters:
key
- The key for the entry that was changed for the eventoldValue
- The previous value before the event takes placeoldMetadata
- The old value before the event takes placenewValue
- The new value for the entry after the event takes placenewMetadata
- The new metadata for the entry after the event takes placeeventType
- 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 interfaceCacheEventFilter<K,
V> - Parameters:
key
- The key for the entry that was changed for the eventoldValue
- The previous value before the event takes placeoldMetadata
- The old value before the event takes placenewValue
- The new value for the entry after the event takes placenewMetadata
- The new metadata for the entry after the event takes placeeventType
- The type of event that is being raised- Returns:
- Whether or not to notify the listener
-
format
- Specified by:
format
in interfaceCacheEventConverter<K,
V, C> - Specified by:
format
in interfaceCacheEventFilter<K,
V> - Specified by:
format
in interfaceCacheEventFilterConverter<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.
-
includeOldValue
public boolean includeOldValue()Description copied from interface:CacheEventConverter
Whether the old value should be returned in the event with the converted value. This is useful when you only care about the converted value and do not want to send around the old value payload. When this is false a null value will be present for any event that has an oldValue.Note the oldValue is only present in
CacheEntryModifiedEvent
andCacheEntryRemovedEvent
for local events and onlyCacheEntryRemovedEvent
for cluster listeners.- Specified by:
includeOldValue
in interfaceCacheEventConverter<K,
V, C> - Returns:
- whether the old value is included in any raised event.
-
injectDependencies
-