Class Projections


  • public final class Projections
    extends java.lang.Object
    A utility class to create basic Projection instances.
    Since:
    3.8
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> Projection<T,​T> identity()
      Returns a projection that does no transformation.
      static <I> Projection<I,​java.lang.Object[]> multiAttribute​(java.lang.String... attributePaths)
      Returns a projection that extracts the value of the given attributePaths.
      static <I,​O>
      Projection<I,​O>
      singleAttribute​(java.lang.String attributePath)
      Returns a projection that extracts the value of the given attributePath.
      • Methods inherited from class java.lang.Object

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

      • identity

        public static <T> Projection<T,​T> identity()
        Returns a projection that does no transformation.

        If you use the returned projection in a 3.9 cluster it may cause a serialization exception.

        Type Parameters:
        T - type
        Since:
        3.10
      • singleAttribute

        public static <I,​O> Projection<I,​O> singleAttribute​(java.lang.String attributePath)
        Returns a projection that extracts the value of the given attributePath.
        Type Parameters:
        I - input type
        O - output type
        Parameters:
        attributePath - single attribute path, path must not be null or empty
      • multiAttribute

        public static <I> Projection<I,​java.lang.Object[]> multiAttribute​(java.lang.String... attributePaths)
        Returns a projection that extracts the value of the given attributePaths. The attribute values will be returned as an Object[] array from each projection call.
        Type Parameters:
        I - input type
        Parameters:
        attributePaths - attribute paths, paths must not be null or empty