public final class Query<T> extends QuerySourceBase implements Queryable<T>
Immutable, lazy and re-executable typed KQL query.
A query is not a collection. Execution occurs only through an explicit terminal operation such as toList(), count(), or stream().
active = query:
from users user
where user.active
rows = active.toList()| Modifier and Type | Member | Description |
|---|---|---|
| public | Query | Creates a lazy query from a provider source and immutable typed plan. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | asQueryasQuery() as Query<T> |
Returns this immutable query. |
| public | countPlancountPlan(plan as QueryPlanBase) as Long |
Counts rows produced by an outer plan. |
| public | executePlanexecutePlan(plan as QueryPlanBase) as Object |
Applies an outer typed plan to this query. |
| public | existsPlanexistsPlan(plan as QueryPlanBase) as Boolean |
Tests whether an outer plan produces a row. |
| public | firstfirst() as T throws NoResultException |
Returns the first row using a one-row provider window. |
| public | firstOrNullfirstOrNull() as Object |
Returns the first row or null. |
| public | openStreamopenStream(plan as QueryPlanBase) as Object |
Opens an outer plan as an independent sequential stream. |
| public | pagepage(request as PageRequest) as Page<T> |
Materializes one page and obtains an exact total count. |
| public | singlesingle() as T throws NoResultException, NonUniqueResultException |
Returns the sole result row. |
| public | singleOrNullsingleOrNull() as Object throws NonUniqueResultException |
Returns the sole row or null. |
| public | sliceslice(request as PageRequest) as Slice<T> |
Materializes one page window without executing an exact count. |
| public | streamstream() as QueryStream<T> |
Opens one independent forward-only result stream. |
| public | toListtoList() as List<T> |
Executes and materializes the query into the standard list type. |
| public | toSettoSet() as Set<T> |
Executes and materializes unique result rows. |