Class 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.
    • 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 entry
        V - 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 entry
        V - 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 as Function.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 the CacheEntry that maps to this key. This function only works when used with a CacheStream returned from the desired Cache. The entry will be read from the Cache of which the CacheStream was created from.
        Type Parameters:
        K - the key type
        V - the expected value type of the entry
        Returns:
        a function that when applied returns the entry for the given key