Class StreamMarshalling


  • public class StreamMarshalling
    extends java.lang.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 Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.function.Predicate<java.lang.Object> alwaysTruePredicate()
      Predicate taht always returns true irrespective of the value provided
      static <K,​V>
      java.util.function.Function<java.util.Map.Entry<K,​V>,​K>
      entryToKeyFunction()
      Provides a function that returns the key of the entry when invoked.
      static <K,​V>
      java.util.function.Function<java.util.Map.Entry<K,​V>,​V>
      entryToValueFunction()
      Provides a function that returns the value of the entry when invoked.
      static java.util.function.Predicate<java.lang.Object> equalityPredicate​(java.lang.Object object)
      Provides a predicate that returns true when the object is equal.
      static <T> java.util.function.Function<T,​T> identity()
      Same as Function.identity() except that this instance is also able to be marshalled by Infinispan.
      static <K,​V>
      java.util.function.Function<K,​CacheEntry<K,​V>>
      keyToEntryFunction()
      Provides a function that given a key will return the CacheEntry that maps to this key.
      static java.util.function.Predicate<java.lang.Object> nonNullPredicate()
      Predicate that returns true if the object passed to it is not null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • equalityPredicate

        public static java.util.function.Predicate<java.lang.Object> equalityPredicate​(java.lang.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 java.util.function.Predicate<java.lang.Object> nonNullPredicate()
        Predicate that returns true if the object passed to it is not null.
        Returns:
        the predicate
      • alwaysTruePredicate

        public static java.util.function.Predicate<java.lang.Object> alwaysTruePredicate()
        Predicate taht always returns true irrespective of the value provided
        Returns:
        the predicate
      • entryToKeyFunction

        public static <K,​V> java.util.function.Function<java.util.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> java.util.function.Function<java.util.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> java.util.function.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> java.util.function.Function<K,​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