Interface FieldProjectionValueStep<N extends FieldProjectionOptionsStep<?,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 FieldProjectionOptionsStep when called directly on this object.
T - The type of projected field values.
All Superinterfaces:
FieldProjectionOptionsStep<N,T>, ProjectionFinalStep<T>

public interface FieldProjectionValueStep<N extends FieldProjectionOptionsStep<?,T>,T> extends FieldProjectionOptionsStep<N,T>
The initial step in a "field" 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 considered single-valued, and its creation will fail if the field is multi-valued.

  • Method Details

    • multi

      @Deprecated(since="8.0") default FieldProjectionOptionsStep<?,List<T>> multi()
      Deprecated.
      Defines the projection as multi-valued, i.e. returning List<T> instead of T.

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

      Returns:
      A new step to define optional parameters for the multi-valued projections.
    • collector

      Defines how to accumulate field projection values.

      Calling .collector(someMultiValuedCollectorProvider) is mandatory for multivalued 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 FieldProjectionOptionsStep<?,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 FieldProjectionOptionsStep<?,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.