Interface CompositeProjectionValueStep<N extends CompositeProjectionOptionsStep<?,T>,T>

Type Parameters:
N - The next step if a method other than collector(ProjectionCollector.Provider) is called, i.e. the return type of methods defined in CompositeProjectionOptionsStep when called directly on this object.
T - The type of composed projections.
All Superinterfaces:
CompositeProjectionOptionsStep<N,T>, ProjectionFinalStep<T>

public interface CompositeProjectionValueStep<N extends CompositeProjectionOptionsStep<?,T>,T> extends CompositeProjectionOptionsStep<N,T>
The step in a composite projection definition where (optionally) the projection collector can be provided, e.g. to mark a projection as multi-valued (returning List/Set etc.) or wrapped in some other container (e.g. Optional<..>), and where optional parameters can be set.

By default (if collector(ProjectionCollector.Provider) is not called), the projection is single-valued.

  • Method Details

    • multi

      Deprecated.
      Defines the projection as multi-valued, i.e. returning List<T> instead of T.

      Calling multi() is mandatory for object projections on multi-valued object fields, otherwise the projection will throw an exception upon creating the search query.

      Calling multi() on basic composite projections is generally not useful: the only effect is that projected values will be wrapped in a one-element List.

      Returns:
      A new step to define optional parameters for the projection.
    • collector

      Defines how to accumulate composite projection values.

      Calling .collector(someMultiValuedCollectorProvider) is mandatory for multi-valued fields, e.g. .collector(ProjectionCollector.list()), otherwise the projection will throw an exception upon creating the query.

      Type Parameters:
      R - The type of the final result.
      Parameters:
      collector - The collector provider to apply to this projection.
      Returns:
      A new step to define optional parameters for the accumulated projections.
    • optional

      Defines the projection as single-valued wrapped in an Optional, i.e. returning Optional<T> instead of T.
      Returns:
      A new step to define optional parameters.
    • list

      Defines the projection as multivalued, i.e. returning List<T> instead of T.
      Returns:
      A new step to define optional parameters.
    • set

      Defines the projection as multivalued, i.e. returning Set<T> instead of T.
      Returns:
      A new step to define optional parameters.
    • sortedSet

      Defines the projection as multivalued, i.e. returning SortedSet<T> instead of T.
      Returns:
      A new step to define optional parameters.
    • sortedSet

      @Incubating default CompositeProjectionOptionsStep<?,SortedSet<T>> sortedSet(Comparator<T> comparator)
      Defines the projection as multivalued, i.e. returning SortedSet<T> instead of T.
      Parameters:
      comparator - The comparator to use for sorting elements within the set.
      Returns:
      A new step to define optional parameters.
    • array

      @Incubating default CompositeProjectionOptionsStep<?,T[]> array(Class<T> type)
      Defines the projection as multivalued, i.e. returning T[] instead of T.
      Parameters:
      type - The type of array elements.
      Returns:
      A new step to define optional parameters.