Package org.infinispan.filter
Class CacheFilters
- java.lang.Object
-
- org.infinispan.filter.CacheFilters
-
public final class CacheFilters extends java.lang.ObjectStatic factory class that contains utility methods that can be used for performing proper transformations fromKeyValueFilter,ConverterandKeyValueFilterConverterto appropriate distributed stream instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCacheFilters.CacheFiltersExternalizer
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V,C>
java.util.stream.Stream<CacheEntry<K,C>>filterAndConvert(java.util.stream.Stream<CacheEntry<K,V>> stream, KeyValueFilterConverter<? super K,? super V,C> filterConverter)Adds needed intermediate operations to the provided stream, returning a possibly new stream as a result of the operations.static <K,V,C>
CacheStream<CacheEntry<K,C>>filterAndConvert(CacheStream<CacheEntry<K,V>> stream, KeyValueFilterConverter<? super K,? super V,C> filterConverter)static <K,V,C>
java.util.function.Function<CacheEntry<K,V>,CacheEntry<K,C>>function(Converter<? super K,? super V,C> converter)Creates a newFunctionusing the provided converter as a basis for the operation.static <K,V>
java.util.function.Predicate<CacheEntry<K,V>>predicate(KeyValueFilter<? super K,? super V> filter)Creates a newPredicateusing the provided key value filter as a basis for the operation.
-
-
-
Method Detail
-
predicate
public static <K,V> java.util.function.Predicate<CacheEntry<K,V>> predicate(KeyValueFilter<? super K,? super V> filter)
Creates a newPredicateusing the provided key value filter as a basis for the operation. This is useful for when usingStream.filter(Predicate)method on distributed streams. The key, value and metadata are all used to determine if the predicate returns true or not.- Type Parameters:
K- key typeV- value type- Parameters:
filter- the filter to utilize- Returns:
- predicate based on the filter
-
function
public static <K,V,C> java.util.function.Function<CacheEntry<K,V>,CacheEntry<K,C>> function(Converter<? super K,? super V,C> converter)
Creates a newFunctionusing the provided converter as a basis for the operation. This is useful for when usingStream.map(Function)method on distributed streams. The key, value and metadata are all used to determine the converted value.- Type Parameters:
K- key typeV- value typeC- convertered value type- Parameters:
converter- the converter to utilize- Returns:
- function based on the converter
-
filterAndConvert
public static <K,V,C> java.util.stream.Stream<CacheEntry<K,C>> filterAndConvert(java.util.stream.Stream<CacheEntry<K,V>> stream, KeyValueFilterConverter<? super K,? super V,C> filterConverter)
Adds needed intermediate operations to the provided stream, returning a possibly new stream as a result of the operations. This method keeps the contract of filter and conversion being performed in only 1 call as theKeyValueFilterConverterwas designed to do. The key, value and metadata are all used to determine whether the value is returned and the converted value.- Type Parameters:
K-V-C-- Parameters:
stream- stream to perform the operations onfilterConverter- converter to apply- Returns:
-
filterAndConvert
public static <K,V,C> CacheStream<CacheEntry<K,C>> filterAndConvert(CacheStream<CacheEntry<K,V>> stream, KeyValueFilterConverter<? super K,? super V,C> filterConverter)
-
-