com.holonplatform.core.query

## Interface QueryProjectionOperations<SR,LR,OR,CR>

- Type Parameters:
    `SR` - Actual Stream result type
    `LR` - Actual List result type
    `OR` - Actual optional single result type
    `CR` - Actual count result type
  All Known Subinterfaces:
    AsyncQuery, AsyncQueryResults, LockQuery, Query, QueryResults

      public interface QueryProjectionOperations<SR,LR,OR,CR>

  Base interface to provide query results using a `QueryProjection`.
  Since:
    5.2.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `CR` | `countAll()` Count all the results of a query.
    `default <P extends Property> OR` | `findOne(Iterable<P> properties)` Execute query and get an expected unique result as `PropertyBox` using given `properties` as projection.
    `default OR` | `findOne(Property... properties)` Execute query and get an expected unique result as `PropertyBox` using given `properties` as projection.
    `<R> OR` | `findOne(QueryProjection<R> projection)` Execute the query and get an expected unique result using given `projection` to map the result to the required type.
    `default <P extends Property> LR` | `list(Iterable<P> properties)` Execute query and get a `List` of query results as `PropertyBox` using given `properties` as projection.
    `default LR` | `list(Property... properties)` Execute query and get a `List` of query results as `PropertyBox` using given `properties` as projection.
    `<R> LR` | `list(QueryProjection<R> projection)` Convenience method to obtain the query results `stream(QueryProjection)` as a `List`
    `default <P extends Property> SR` | `stream(Iterable<P> properties)` Execute query and get a `Stream` of query results as `PropertyBox` using given `properties` as projection.
    `default SR` | `stream(Property... properties)` Execute query and get a `Stream` of query results as `PropertyBox` using given `properties` as projection.
    `<R> SR` | `stream(QueryProjection<R> projection)` Execute the query and get a `Stream` of query results using given `projection` to map results to the required type.

- - ### Method Detail

    - #### stream

          <R> SR stream(QueryProjection<R> projection)

      Execute the query and get a `Stream` of query results using given `projection` to map results to the required type.
      Type Parameters:
        `R` - Query projection (result) type
      Parameters:
        `projection` - Query projection (not null)
      Returns:
        Query results stream
      Throws:
        `DataAccessException` - Error in query execution

    - #### list

          <R> LR list(QueryProjection<R> projection)

      Convenience method to obtain the query results `stream(QueryProjection)` as a `List`
      Type Parameters:
        `R` - Query projection (result) type
      Parameters:
        `projection` - Query projection (not null)
      Returns:
        Query results list, an empty List if none
      Throws:
        `DataAccessException` - Error in query execution

    - #### findOne

          <R> OR findOne(QueryProjection<R> projection)
                  throws QueryResults.QueryNonUniqueResultException

      Execute the query and get an expected unique result using given `projection` to map the result to the required type.

      If more than one result is returned by the query, a `QueryResults.QueryNonUniqueResultException` is thrown.

      Type Parameters:
        `R` - Result type
      Parameters:
        `projection` - Query projection (not null)
      Returns:
        Optional unique query result (an empty Optional if no results was returned from query execution)
      Throws:
        `QueryResults.QueryNonUniqueResultException` - Only one result expected but more than one was found
        `DataAccessException` - Error in query execution

    - #### countAll

          CR countAll()

      Count all the results of a query.
      Returns:
        Total results count
      Throws:
        `DataAccessException` - Error in query execution

    - #### stream

          default <P extends Property> SR stream(Iterable<P> properties)

      Execute query and get a `Stream` of query results as `PropertyBox` using given `properties` as projection.

      Returned `PropertyBox` instances will contain the values of the properties specified in given `properties` set.

      Type Parameters:
        `P` - Property type
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        Query results `PropertyBox` stream
      Throws:
        `DataAccessException` - Error in query execution

    - #### findOne

          default <P extends Property> OR findOne(Iterable<P> properties)
                                           throws QueryResults.QueryNonUniqueResultException

      Execute query and get an expected unique result as `PropertyBox` using given `properties` as projection.

      Returned `PropertyBox` instance will contain the values of the properties specified in given `properties` set.

      Type Parameters:
        `P` - Property type
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        Optional unique query result (an empty Optional if no results was returned from query execution)
      Throws:
        `QueryResults.QueryNonUniqueResultException` - Only one result expected but more than one was found
        `DataAccessException` - Error in query execution

    - #### list

          default <P extends Property> LR list(Iterable<P> properties)

      Execute query and get a `List` of query results as `PropertyBox` using given `properties` as projection.

      Returned `PropertyBox` instances will contain the values of the properties specified in given `properties` set.

      Type Parameters:
        `P` - Property type
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        Query results `PropertyBox` list
      Throws:
        `DataAccessException` - Error in query execution

    - #### stream

          default SR stream(Property... properties)

      Execute query and get a `Stream` of query results as `PropertyBox` using given `properties` as projection.

      Returned `PropertyBox` instances will contain the values of the properties specified in given `properties` set.

      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        Query results `PropertyBox` stream
      Throws:
        `DataAccessException` - Error in query execution

    - #### findOne

          default OR findOne(Property... properties)
                      throws QueryResults.QueryNonUniqueResultException

      Execute query and get an expected unique result as `PropertyBox` using given `properties` as projection.

      Returned `PropertyBox` instance will contain the values of the properties specified in given `properties` set.

      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        Optional unique query result (an empty Optional if no results was returned from query execution)
      Throws:
        `QueryResults.QueryNonUniqueResultException` - Only one result expected but more than one was found
        `DataAccessException` - Error in query execution

    - #### list

          default LR list(Property... properties)

      Execute query and get a `List` of query results as `PropertyBox` using given `properties` as projection.

      Returned `PropertyBox` instances will contain the values of the properties specified in given `properties` set.

      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        Query results `PropertyBox` list
      Throws:
        `DataAccessException` - Error in query execution

Copyright © 2019 The Holon Platform. All rights reserved.