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
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescriptionKeyValueFilterConverterAsCacheEventFilterConverter(KeyValueFilterConverter<K, V, C> keyValueFilterConverter) KeyValueFilterConverterAsCacheEventFilterConverter(KeyValueFilterConverter<K, V, C> keyValueFilterConverter, MediaType format) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(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()booleanWhether the old value should be returned in the event with the converted value.protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:CacheEventFilterConverterWill both filter the entry and if passed subsequently convert the value to a new value. A returned value ofnullwill symbolize the value not passing the filter, so ensure your conversion will not returnnullif you want this entry to be returned.- Specified by:
filterAndConvertin 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
nullvalue converted value when it also passes the filter ornullfor 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:CacheEventConverterConverts the given newValue into something different possibly.- Specified by:
convertin 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:CacheEventFilterWhether or not this event should be raised to the listener it is attached to.- Specified by:
acceptin 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:
formatin interfaceCacheEventConverter<K,V, C> - Specified by:
formatin interfaceCacheEventFilter<K,V> - Specified by:
formatin 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:CacheEventConverterWhether 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
CacheEntryModifiedEventandCacheEntryRemovedEventfor local events and onlyCacheEntryRemovedEventfor cluster listeners.- Specified by:
includeOldValuein interfaceCacheEventConverter<K,V, C> - Returns:
- whether the old value is included in any raised event.
-
injectDependencies
-