com.holonplatform.datastore.mongo.core.expression

## Interface BsonProjection<R>

- Type Parameters:
    `R` - Projection result type
  All Superinterfaces:
    com.holonplatform.core.Expression, com.holonplatform.core.TypedExpression<R>

      public interface BsonProjection<R>
      extends com.holonplatform.core.TypedExpression<R>

  Mongo query projection expression.
  Since:
    5.2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `BsonProjection.Builder<R>` Builder.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.Expression

      `com.holonplatform.core.Expression.ExpressionResolverFunction<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression>, com.holonplatform.core.Expression.InvalidExpressionException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <R> BsonProjection.Builder<R>` | `builder(Class<R> projectionType)` Get a new `BsonProjection` builder.
    `static <R> BsonProjection.Builder<R>` | `builder(Class<R> projectionType, boolean countAllProjection)` Get a new `BsonProjection` builder.
    `static BsonProjection<Long>` | `countAll()` Create a new count all `BsonProjection`.
    `Optional<DocumentConverter<R>>` | `getConverter()` Get the projection `DocumentConverter`.
    `List<String>` | `getFieldNames()` Get the field names.
    `List<org.bson.conversions.Bson>` | `getFieldProjections()` Get the field projection values.
    `Map<String,org.bson.conversions.Bson>` | `getFields()` Get the projection fields as field name - Bson expression map.
    `boolean` | `hasAggregationFunctions()` Get whether this projection include one or more aggregation functions (for example min, man, sum, avg, count).
    `boolean` | `isCountAllProjection()` Get whether this projection is a count all projection.
    `Optional<String>` | `isCountFieldProjection()` Get whether this projection is a count projection on a specific field name.
    `default boolean` | `isEmpty()` Get whether the projection is empty.

    - ### Methods inherited from interface com.holonplatform.core.TypedExpression

      `getTemporalType, getType, isCollectionExpression, isConverterExpression`

    - ### Methods inherited from interface com.holonplatform.core.Expression

      `validate`

- - ### Method Detail

    - #### isEmpty

          default boolean isEmpty()

      Get whether the projection is empty.
      Returns:
        whether the projection is empty

    - #### getFields

          Map<String,org.bson.conversions.Bson> getFields()

      Get the projection fields as field name - Bson expression map.
      Returns:
        the projection fields

    - #### getFieldNames

          List<String> getFieldNames()

      Get the field names.
      Returns:
        field names

    - #### getFieldProjections

          List<org.bson.conversions.Bson> getFieldProjections()

      Get the field projection values.
      Returns:
        field projection values

    - #### getConverter

          Optional<DocumentConverter<R>> getConverter()

      Get the projection `DocumentConverter`.
      Returns:
        Oprional document converter

    - #### isCountAllProjection

          boolean isCountAllProjection()

      Get whether this projection is a count all projection.
      Returns:
        Whether this projection is a count all projection

    - #### isCountFieldProjection

          Optional<String> isCountFieldProjection()

      Get whether this projection is a count projection on a specific field name.
      Returns:
        If this projection is a count projection on a specific field name, return the field name, otherwise an empty Optional

    - #### hasAggregationFunctions

          boolean hasAggregationFunctions()

      Get whether this projection include one or more aggregation functions (for example min, man, sum, avg, count).
      Returns:
        Whether this projection include one or more aggregation functions

    - #### countAll

          static BsonProjection<Long> countAll()

      Create a new count all `BsonProjection`.
      Returns:
        A new count all `BsonProjection`

    - #### builder

          static <R> BsonProjection.Builder<R> builder(Class<R> projectionType)

      Get a new `BsonProjection` builder.
      Type Parameters:
        `R` - Projection result type
      Parameters:
        `projectionType` - Projection result type
      Returns:
        A new `BsonProjection` builder

    - #### builder

          static <R> BsonProjection.Builder<R> builder(Class<R> projectionType,
                                                       boolean countAllProjection)

      Get a new `BsonProjection` builder.
      Type Parameters:
        `R` - Projection result type
      Parameters:
        `projectionType` - Projection result type
        `countAllProjection` - Whether the projection is a count all projection
      Returns:
        A new `BsonProjection` builder

Copyright © 2019 The Holon Platform. All rights reserved.