com.holonplatform.async.datastore.operation

## Interface AsyncQueryResults

- All Superinterfaces:
    QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>
  All Known Subinterfaces:
    AsyncQuery

      public interface AsyncQueryResults
      extends QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>

  Asynchronous `QueryProjectionOperations` API, which uses `CompletionStage` to provide the query results and handle the results asynchronously.
  Since:
    5.2.0
  See Also:
    `AsyncQuery`

- - ### Method Summary

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

- - ### Method Detail

    - #### stream

          <R> CompletionStage<Stream<R>> stream(QueryProjection<R> projection)

      Execute query asynchronously and get a `Stream` of query results using given `projection` to map the results to the required type.
      Specified by:
        `stream` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Type Parameters:
        `R` - Results type
      Parameters:
        `projection` - Query projection (not null)
      Returns:
        A `CompletionStage` of query results stream, an empty Stream if none
      Throws:
        `DataAccessException` - Error in query execution

    - #### list

          default <R> CompletionStage<List<R>> list(QueryProjection<R> projection)

      Convenience method to obtain the query results `stream(QueryProjection)` as a `List`.
      Specified by:
        `list` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Type Parameters:
        `R` - Results type
      Parameters:
        `projection` - Query projection (not null)
      Returns:
        A `CompletionStage` of query results list, an empty List if none
      Throws:
        `DataAccessException` - Error in query execution

    - #### findOne

          default <R> CompletionStage<Optional<R>> findOne(QueryProjection<R> projection)
                                                    throws QueryResults.QueryNonUniqueResultException

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

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

      Specified by:
        `findOne` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Type Parameters:
        `R` - Result type
      Parameters:
        `projection` - Query projection (not null)
      Returns:
        A `CompletionStage` of the Optional unique query result (an empty Optional if no results was returned)
      Throws:
        `QueryResults.QueryNonUniqueResultException` - Only one result expected but more than one was found
        `DataAccessException` - Error in query execution

    - #### countAll

          default CompletionStage<Long> countAll()

      Count all the results of a query, asynchronously.
      Specified by:
        `countAll` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Returns:
        A `CompletionStage` of the total results count
      Throws:
        `DataAccessException` - Error in query execution

    - #### count

          default CompletionStage<Long> count()

      Convenience `countAll()` renamed method.
      Returns:
        A `CompletionStage` of the total results count

    - #### stream

          default <P extends Property> CompletionStage<Stream<PropertyBox>> stream(Iterable<P> properties)

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

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

      Specified by:
        `stream` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Type Parameters:
        `P` - Property type
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        A `CompletionStage` of the query results `Stream` (an empty Stream if none)
      Throws:
        `DataAccessException` - Error in query execution

    - #### findOne

          default <P extends Property> CompletionStage<Optional<PropertyBox>> findOne(Iterable<P> properties)
                                                                               throws QueryResults.QueryNonUniqueResultException

      Execute the query asynchronously and get an expected unique result as a `PropertyBox` instance, using given `properties` as projection.

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

      Specified by:
        `findOne` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Type Parameters:
        `P` - Property type
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        A `CompletionStage` of the Optional unique query result (an empty Optional if no results was returned)
      Throws:
        `QueryResults.QueryNonUniqueResultException` - Only one result expected but more than one was found
        `DataAccessException` - Error in query execution

    - #### list

          default <P extends Property> CompletionStage<List<PropertyBox>> list(Iterable<P> properties)

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

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

      Specified by:
        `list` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Type Parameters:
        `P` - Property type
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        A `CompletionStage` of the query results `List` (an empty List if none)
      Throws:
        `DataAccessException` - Error in query execution

    - #### stream

          default CompletionStage<Stream<PropertyBox>> stream(Property... properties)

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

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

      Specified by:
        `stream` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        A `CompletionStage` of the query results `Stream` (an empty Stream if none)
      Throws:
        `DataAccessException` - Error in query execution

    - #### findOne

          default CompletionStage<Optional<PropertyBox>> findOne(Property... properties)
                                                          throws QueryResults.QueryNonUniqueResultException

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

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

      Specified by:
        `findOne` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        A `CompletionStage` of the Optional unique query result (an empty Optional if no results was returned)
      Throws:
        `QueryResults.QueryNonUniqueResultException` - Only one result expected but more than one was found
        `DataAccessException` - Error in query execution

    - #### list

          default CompletionStage<List<PropertyBox>> list(Property... properties)

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

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

      Specified by:
        `list` in interface `QueryProjectionOperations<CompletionStage,CompletionStage,CompletionStage,CompletionStage<Long>>`
      Parameters:
        `properties` - Property set to use as projection (not null)
      Returns:
        A `CompletionStage` of the query results `List` (an empty List if none)
      Throws:
        `DataAccessException` - Error in query execution

Copyright © 2019 The Holon Platform. All rights reserved.