Package org.infinispan.stream
Class StreamMarshalling
- java.lang.Object
-
- org.infinispan.stream.StreamMarshalling
-
public class StreamMarshalling extends Object
Static factory class containing methods that will provide marshallable instances for very common use cases. Every instance returned from the various static methods uses the Infinispan marshalling to reduce payload sizes considerably and should be used whenever possible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StreamMarshalling.StreamMarshallingExternalizer
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Predicate<Object>
alwaysTruePredicate()
Predicate taht always returns true irrespective of the value providedstatic <K,V>
Function<Map.Entry<K,V>,K>entryToKeyFunction()
Provides a function that returns the key of the entry when invoked.static <K,V>
Function<Map.Entry<K,V>,V>entryToValueFunction()
Provides a function that returns the value of the entry when invoked.static Predicate<Object>
equalityPredicate(Object object)
Provides a predicate that returns true when the object is equal.static <T> Function<T,T>
identity()
Same asFunction.identity()
except that this instance is also able to be marshalled by Infinispan.static <K,V>
Function<K,org.infinispan.container.entries.CacheEntry<K,V>>keyToEntryFunction()
Provides a function that given a key will return theCacheEntry
that maps to this key.static Predicate<Object>
nonNullPredicate()
Predicate that returns true if the object passed to it is not null.
-
-
-
Method Detail
-
equalityPredicate
public static Predicate<Object> equalityPredicate(Object object)
Provides a predicate that returns true when the object is equal.- Parameters:
object
- the instance to test equality on- Returns:
- the predicate
-
nonNullPredicate
public static Predicate<Object> nonNullPredicate()
Predicate that returns true if the object passed to it is not null.- Returns:
- the predicate
-
alwaysTruePredicate
public static Predicate<Object> alwaysTruePredicate()
Predicate taht always returns true irrespective of the value provided- Returns:
- the predicate
-
entryToKeyFunction
public static <K,V> Function<Map.Entry<K,V>,K> entryToKeyFunction()
Provides a function that returns the key of the entry when invoked.- Type Parameters:
K
- key type of the entryV
- value type of the entry- Returns:
- a function that when applied to a given entry will return the key
-
entryToValueFunction
public static <K,V> Function<Map.Entry<K,V>,V> entryToValueFunction()
Provides a function that returns the value of the entry when invoked.- Type Parameters:
K
- key type of the entryV
- value type of the entry- Returns:
- a function that when applied to a given entry will return the value
-
identity
public static <T> Function<T,T> identity()
Same asFunction.identity()
except that this instance is also able to be marshalled by Infinispan.- Type Parameters:
T
- any type- Returns:
- function that just returns the provided value
-
keyToEntryFunction
public static <K,V> Function<K,org.infinispan.container.entries.CacheEntry<K,V>> keyToEntryFunction()
Provides a function that given a key will return theCacheEntry
that maps to this key. This function only works when used with aCacheStream
returned from the desiredCache
. The entry will be read from the Cache of which the CacheStream was created from.- Type Parameters:
K
- the key typeV
- the expected value type of the entry- Returns:
- a function that when applied returns the entry for the given key
-
-