com.holonplatform.core.query

## Interface QueryBuilder<Q extends QueryBuilder<Q>>

- Type Parameters:
    `Q` - Concrete QueryBuilder
  All Superinterfaces:
    DataTarget.DataTargetSupport<Q>, ExpressionResolver.ExpressionResolverBuilder<Q>, QueryAggregation.QueryAggregationSupport<Q>, QueryFilter.QueryFilterSupport<Q>, QuerySort.QuerySortSupport<Q>
  All Known Subinterfaces:
    AsyncQuery, LockQuery, Query, SubQuery<T>

      public interface QueryBuilder<Q extends QueryBuilder<Q>>
      extends QueryFilter.QueryFilterSupport<Q>, QuerySort.QuerySortSupport<Q>, DataTarget.DataTargetSupport<Q>, QueryAggregation.QueryAggregationSupport<Q>, ExpressionResolver.ExpressionResolverBuilder<Q>

  Builder to configure a `Query`, managing query `DataTarget` and query clauses such as `QueryFilter` and `QuerySort` and handling `ExpressionResolver`s registration.
  Since:
    5.0.0
  See Also:
    `Query`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Q` | `distinct()` Configure the query to return distinct query projection result values.
    `QueryConfiguration` | `getQueryConfiguration()` Get the current `QueryConfiguration`.
    `Q` | `limit(int limit)` Limit the fetched result set
    `Q` | `offset(int offset)` Starts the query results at a particular zero-based offset.
    `<T> Q` | `parameter(ConfigProperty<T> property, T value)` Add a parameter to query using a `ConfigProperty` and `ConfigProperty.getKey()` as parameter name.
    `Q` | `parameter(String name, Object value)` Add a generic parameter to query
    `Q` | `restrict(int limit, int offset)` Convenience method to set `limit(int)` and `offset(int)` of query results both in one call

    - ### Methods inherited from interface com.holonplatform.core.query.QueryFilter.QueryFilterSupport

      `filter, filter, filter`

    - ### Methods inherited from interface com.holonplatform.core.query.QuerySort.QuerySortSupport

      `sort, sort, sort`

    - ### Methods inherited from interface com.holonplatform.core.datastore.DataTarget.DataTargetSupport

      `target, target`

    - ### Methods inherited from interface com.holonplatform.core.query.QueryAggregation.QueryAggregationSupport

      `aggregate, aggregate, aggregate`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverBuilder

      `withExpressionResolver`

- - ### Method Detail

    - #### getQueryConfiguration

          QueryConfiguration getQueryConfiguration()

      Get the current `QueryConfiguration`.
      Returns:
        the current `QueryConfiguration`

    - #### limit

          Q limit(int limit)

      Limit the fetched result set
      Parameters:
        `limit` - Results limit. Must be > 0. A value <= 0 indicates no limit.
      Returns:
        this

    - #### offset

          Q offset(int offset)

      Starts the query results at a particular zero-based offset.
      Parameters:
        `offset` - Results offset 0-based index. Must be >= 0.
      Returns:
        this

    - #### restrict

          Q restrict(int limit,
                     int offset)

      Convenience method to set `limit(int)` and `offset(int)` of query results both in one call
      Parameters:
        `limit` - limit Results limit. Must be > 0. A value <= 0 indicates no limit.
        `offset` - offset Results offset 0-based index. Must be >= 0.
      Returns:
        this

    - #### parameter

          Q parameter(String name,
                      Object value)

      Add a generic parameter to query
      Parameters:
        `name` - Parameter name
        `value` - Parameter value
      Returns:
        this

    - #### parameter

          <T> Q parameter(ConfigProperty<T> property,
                          T value)

      Add a parameter to query using a `ConfigProperty` and `ConfigProperty.getKey()` as parameter name.
      Type Parameters:
        `T` - Config property type
      Parameters:
        `property` - The configuration property (not null)
        `value` - Parameter value
      Returns:
        this

    - #### distinct

          Q distinct()

      Configure the query to return distinct query projection result values.
      Returns:
        this
      Since:
        5.2.0

Copyright © 2019 The Holon Platform. All rights reserved.