public interface QueryResults extends QueryProjectionOperations<Stream,List,Optional,Long>
Query
operation using a QueryProjection
.Query
Modifier and Type | Interface and Description |
---|---|
static class |
QueryResults.QueryNonUniqueResultException
Exception thrown by when only one query result was expected but more than one found.
|
Modifier and Type | Method and Description |
---|---|
default long |
count()
Count all the results of a query.
|
default Long |
countAll()
Count all the results of a query.
|
default <P extends Property> |
findOne(Iterable<P> properties)
Execute query and get an expected unique result as
PropertyBox using given properties as
projection. |
default Optional<PropertyBox> |
findOne(Property... properties)
Execute query and get an expected unique result as
PropertyBox using given properties as
projection. |
default <R> Optional<R> |
findOne(QueryProjection<R> projection)
Execute query and get an expected unique result using
projection to map result to required type. |
default <P extends Property> |
list(Iterable<P> properties)
|
default List<PropertyBox> |
list(Property... properties)
|
default <R> List<R> |
list(QueryProjection<R> projection)
Convenience method to obtain the query results
stream(QueryProjection) as a List |
default <P extends Property> |
stream(Iterable<P> properties)
Execute query and get a
Stream of query results as PropertyBox using given
properties as projection. |
default Stream<PropertyBox> |
stream(Property... properties)
Execute query and get a
Stream of query results as PropertyBox using given
properties as projection. |
<R> Stream<R> |
stream(QueryProjection<R> projection)
Execute query and get a
Stream of query results using given projection to map results to
required type. |
<R> Stream<R> stream(QueryProjection<R> projection)
Stream
of query results using given projection
to map results to
required type.stream
in interface QueryProjectionOperations<Stream,List,Optional,Long>
R
- Results typeprojection
- Query projection (not null)DataAccessException
- Error in query executiondefault <R> List<R> list(QueryProjection<R> projection)
stream(QueryProjection)
as a List
list
in interface QueryProjectionOperations<Stream,List,Optional,Long>
R
- Results typeprojection
- Query projection (not null)DataAccessException
- Error in query executiondefault <R> Optional<R> findOne(QueryProjection<R> projection) throws QueryResults.QueryNonUniqueResultException
projection
to map result to required type.
If more than one result is returned by the query, a QueryResults.QueryNonUniqueResultException
is thrown.
findOne
in interface QueryProjectionOperations<Stream,List,Optional,Long>
R
- Result typeprojection
- Query projection (not null)QueryResults.QueryNonUniqueResultException
- Only one result expected but more than one was foundDataAccessException
- Error in query executiondefault Long countAll()
countAll
in interface QueryProjectionOperations<Stream,List,Optional,Long>
DataAccessException
- Error in query executiondefault long count()
This is countAll()
alternative convenience method to provide a primitive long type result.
DataAccessException
- Error in query executiondefault <P extends Property> Stream<PropertyBox> stream(Iterable<P> properties)
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.
stream
in interface QueryProjectionOperations<Stream,List,Optional,Long>
P
- Property typeproperties
- Property set to use as projection (not null)PropertyBox
streamDataAccessException
- Error in query executiondefault <P extends Property> Optional<PropertyBox> findOne(Iterable<P> properties) throws QueryResults.QueryNonUniqueResultException
PropertyBox
using given properties
as
projection.
Returned PropertyBox
instance will contain the values of the properties specified in given
properties
set.
findOne
in interface QueryProjectionOperations<Stream,List,Optional,Long>
P
- Property typeproperties
- Property set to use as projection (not null)QueryResults.QueryNonUniqueResultException
- Only one result expected but more than one was foundDataAccessException
- Error in query executiondefault <P extends Property> List<PropertyBox> list(Iterable<P> properties)
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.
list
in interface QueryProjectionOperations<Stream,List,Optional,Long>
P
- Property typeproperties
- Property set to use as projection (not null)PropertyBox
listDataAccessException
- Error in query executiondefault Stream<PropertyBox> stream(Property... properties)
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.
stream
in interface QueryProjectionOperations<Stream,List,Optional,Long>
properties
- Property set to use as projection (not null)PropertyBox
streamDataAccessException
- Error in query executiondefault Optional<PropertyBox> findOne(Property... properties) throws QueryResults.QueryNonUniqueResultException
PropertyBox
using given properties
as
projection.
Returned PropertyBox
instance will contain the values of the properties specified in given
properties
set.
findOne
in interface QueryProjectionOperations<Stream,List,Optional,Long>
properties
- Property set to use as projection (not null)QueryResults.QueryNonUniqueResultException
- Only one result expected but more than one was foundDataAccessException
- Error in query executiondefault List<PropertyBox> list(Property... properties)
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.
list
in interface QueryProjectionOperations<Stream,List,Optional,Long>
properties
- Property set to use as projection (not null)PropertyBox
listDataAccessException
- Error in query executionCopyright © 2019 The Holon Platform. All rights reserved.