public abstract static class Query.Builder<T> extends java.lang.Object implements QueryBuilder<T>, QueryBuilder.Selecting<T>, QueryBuilder.Filtering<T>, QueryBuilder.FilteringCriteria<T>, QueryBuilder.Grouping<T>, QueryBuilder.Aggregating<T>, QueryBuilder.Paging<T>, QueryBuilder.Sorting<T>
The objective of this builder is to help the developer to construct a Query in a more organic way to ease development and avoid invalid configurations.
Each method returns the same Builder instance, but it is bound by interface which the method returns. This way is simulating a flow and the available valid configurations after the current configuration.
QueryBuilder.Aggregating<T>, QueryBuilder.Filtering<T>, QueryBuilder.FilteringCriteria<T>, QueryBuilder.Grouping<T>, QueryBuilder.Paging<T>, QueryBuilder.Selecting<T>, QueryBuilder.Sorting<T>
Modifier | Constructor and Description |
---|---|
protected |
Builder()
Initializes a newly created
Builder |
protected |
Builder(Query query)
Constructs a
Builder using the given Query as a base |
Modifier and Type | Method and Description |
---|---|
QueryBuilder.Grouping<T> |
aggregate(AggregationColumn... a)
Obtains the set of operations allowed after
Aggregating |
QueryBuilder.Grouping<T> |
aggregate(java.util.List<AggregationColumn> a)
Obtains the set of operations allowed after
Aggregating |
QueryBuilder.Grouping<T> |
and(Criteria... criteria)
Obtains the set of operations allowed after
FilteringCriteria |
Query<T> |
build()
Produces a
Query instance at any point in time its called. |
QueryBuilder.Grouping<T> |
criteria(Criteria criteria)
Obtains the set of operations allowed after
FilteringCriteria |
QueryBuilder.Aggregating<T> |
groupBy(Column... c)
Obtains the set of operations allowed after
Grouping |
QueryBuilder.Aggregating<T> |
groupBy(ColumnAlias... alias)
Obtains the set of operations allowed after
Grouping |
QueryBuilder.Aggregating<T> |
groupBy(java.lang.String... c)
Obtains the set of operations allowed after
Grouping |
protected abstract LogicalExpression<?> |
newLogicalOperation(LogicalOperator lo,
java.util.List<Criteria> conditions)
Returns a
LogicalExpression instance |
protected Query<T> |
newQuerySimplified(Projection<? extends Column> projection,
Criteria criteria,
PagingInfo pagingInfo) |
QueryBuilder.Grouping<T> |
or(Criteria... criteria)
Obtains the set of operations allowed after
FilteringCriteria |
QueryBuilder.Sorting<T> |
page(int startIndex,
int batchSize)
Obtains the set of operations allowed after
Paging |
QueryBuilder<T> |
page(PagingInfo pagingInfo)
Defines query's
PagingInfo |
QueryBuilder.Grouping<T> |
project(Aggregation a)
Obtains the set of operations allowed after
Aggregating |
QueryBuilder.Filtering<T> |
project(Selection s)
Obtains the set of operations allowed after
Selecting |
QueryBuilder.Filtering<T> |
select(java.util.Collection<java.lang.String> c)
Obtains the set of operations allowed after
Selecting |
QueryBuilder.Filtering<T> |
select(Column... c)
Obtains the set of operations allowed after
Selecting |
QueryBuilder.Filtering<T> |
select(ColumnAlias... alias)
Obtains the set of operations allowed after
Selecting |
QueryBuilder.Filtering<T> |
select(java.util.List<Column> c)
Obtains the set of operations allowed after
Selecting |
QueryBuilder.Filtering<T> |
select(java.lang.String... c)
Obtains the set of operations allowed after
Selecting |
QueryBuilder.Filtering<T> |
selectFirst(java.lang.String column) |
QueryBuilder<T> |
sortBy(com.google.common.collect.ImmutableList<ReadOnlySortInfo> sortInfos)
Defines the query's sorting information
|
QueryBuilder<T> |
sortBy(java.util.List<SortInfo> sortInfos)
Defines the query's sorting information
|
QueryBuilder<T> |
sortBy(ReadOnlySortInfo... sortInfos)
Defines the query's sorting information
|
QueryBuilder<T> |
sortBy(SortInfo... sortInfos)
Defines the query's sorting information
|
protected Builder()
Builder
protected Builder(Query query)
Builder
using the given Query
as a basequery
- a Query
protected final Query<T> newQuerySimplified(Projection<? extends Column> projection, Criteria criteria, PagingInfo pagingInfo)
public QueryBuilder.Filtering<T> select(java.lang.String... c)
QueryBuilder.Selecting
Selecting
select
in interface QueryBuilder.Selecting<T>
c
- the array of column names which the query is going to selectFiltering
interface with the set of operations allowed after Selecting
public QueryBuilder.Filtering<T> select(java.util.Collection<java.lang.String> c)
QueryBuilder.Selecting
Selecting
select
in interface QueryBuilder.Selecting<T>
c
- the list of column names which the query is going to selectFiltering
interface with the set of operations allowed after Selecting
public QueryBuilder.Filtering<T> selectFirst(java.lang.String column)
public QueryBuilder.Filtering<T> select(ColumnAlias... alias)
QueryBuilder.Selecting
Selecting
select
in interface QueryBuilder.Selecting<T>
alias
- the array of ColumnAlias
which the query is going to selectFiltering
interface with the set of operations allowed after Selecting
public QueryBuilder.Filtering<T> select(Column... c)
QueryBuilder.Selecting
Selecting
select
in interface QueryBuilder.Selecting<T>
c
- the array of Column
which the query is going to selectFiltering
interface with the set of operations allowed after Selecting
public QueryBuilder.Filtering<T> select(java.util.List<Column> c)
QueryBuilder.Selecting
Selecting
select
in interface QueryBuilder.Selecting<T>
c
- the list of ColumnAlias
which the query is going to selectFiltering
interface with the set of operations allowed after Selecting
public QueryBuilder.Filtering<T> project(Selection s)
QueryBuilder.Selecting
Selecting
project
in interface QueryBuilder.Selecting<T>
s
- the Selection
to be performed by the queryFiltering
interface with the set of operations allowed after Selecting
public QueryBuilder.Grouping<T> criteria(Criteria criteria)
QueryBuilder.FilteringCriteria
FilteringCriteria
criteria
in interface QueryBuilder.Filtering<T>
criteria
in interface QueryBuilder.FilteringCriteria<T>
criteria
- The Criteria
used to bound the query.Grouping
interface with the set of operations allowed after FilteringCriteria
public QueryBuilder.Grouping<T> and(Criteria... criteria)
QueryBuilder.FilteringCriteria
FilteringCriteria
and
in interface QueryBuilder.Filtering<T>
and
in interface QueryBuilder.FilteringCriteria<T>
criteria
- The Criteria
that will be combined with the existing Criteria using the AND operator.Grouping
interface with the set of operations allowed after Filtering
public QueryBuilder.Grouping<T> or(Criteria... criteria)
QueryBuilder.FilteringCriteria
FilteringCriteria
or
in interface QueryBuilder.Filtering<T>
or
in interface QueryBuilder.FilteringCriteria<T>
criteria
- The Criteria
that will be combined with the existing Criteria using the OR operator.Grouping
interface with the set of operations allowed after Filtering
public QueryBuilder.Aggregating<T> groupBy(java.lang.String... c)
QueryBuilder.Grouping
Grouping
groupBy
in interface QueryBuilder.Grouping<T>
c
- the array of column names which the query is going to group by.Aggregating
interface with the set of operations allowed after Grouping
public QueryBuilder.Aggregating<T> groupBy(ColumnAlias... alias)
QueryBuilder.Grouping
Grouping
groupBy
in interface QueryBuilder.Grouping<T>
alias
- the array of ColumnAlias
which the query is going to group by.Aggregating
interface with the set of operations allowed after Grouping
public QueryBuilder.Aggregating<T> groupBy(Column... c)
QueryBuilder.Grouping
Grouping
groupBy
in interface QueryBuilder.Grouping<T>
c
- the array of Column
which the query is going to group by.Aggregating
interface with the set of operations allowed after Grouping
public QueryBuilder.Grouping<T> aggregate(AggregationColumn... a)
QueryBuilder.Aggregating
Aggregating
aggregate
in interface QueryBuilder.Aggregating<T>
a
- the array of AggregationColumn
where the query is going perform aggregation operations.Grouping
interface with the set of operations allowed after Aggregating
public QueryBuilder.Grouping<T> aggregate(java.util.List<AggregationColumn> a)
QueryBuilder.Aggregating
Aggregating
aggregate
in interface QueryBuilder.Aggregating<T>
a
- the list of AggregationColumn
where the query is going perform aggregation operations.Grouping
interface with the set of operations allowed after Aggregating
public QueryBuilder.Grouping<T> project(Aggregation a)
QueryBuilder.Aggregating
Aggregating
project
in interface QueryBuilder.Aggregating<T>
a
- the Aggregation
to be performed by the query.Grouping
interface with the set of operations allowed after Aggregating
public QueryBuilder.Sorting<T> page(int startIndex, int batchSize)
QueryBuilder.Paging
Paging
page
in interface QueryBuilder.Paging<T>
batchSize
- the number of results to return in one page. If negative, the full
result set should be returned.Sorting
interface with the set of operations allowed after Paging
public QueryBuilder<T> page(PagingInfo pagingInfo)
QueryBuilder.Paging
PagingInfo
page
in interface QueryBuilder.Paging<T>
pagingInfo
- the PagingInfo
describing how to page the resultsQueryBuilder
which can produce a Query
instance.public QueryBuilder<T> sortBy(SortInfo... sortInfos)
QueryBuilder.Sorting
sortBy
in interface QueryBuilder.Sorting<T>
sortInfos
- the array of SortInfo
which the query is going to use to determine the order
of the result data.QueryBuilder
which can produce a Query
instance.public QueryBuilder<T> sortBy(java.util.List<SortInfo> sortInfos)
QueryBuilder.Sorting
sortBy
in interface QueryBuilder.Sorting<T>
sortInfos
- the list of SortInfo
which the query is going to use to determine the order
of the result data.QueryBuilder
which can produce a Query
instance.public QueryBuilder<T> sortBy(ReadOnlySortInfo... sortInfos)
QueryBuilder.Sorting
sortBy
in interface QueryBuilder.Sorting<T>
sortInfos
- the array of ReadOnlySortInfo
which the query is going to use to determine the order
of the result data.QueryBuilder
which can produce a Query
instance.public QueryBuilder<T> sortBy(com.google.common.collect.ImmutableList<ReadOnlySortInfo> sortInfos)
QueryBuilder.Sorting
sortBy
in interface QueryBuilder.Sorting<T>
sortInfos
- the list of ReadOnlySortInfo
which the query is going to use to determine the order
of the result data.QueryBuilder
which can produce a Query
instance.public Query<T> build()
QueryBuilder
Query
instance at any point in time its called.build
in interface QueryBuilder<T>
Query
instance.protected abstract LogicalExpression<?> newLogicalOperation(LogicalOperator lo, java.util.List<Criteria> conditions)
LogicalExpression
instancelo
- logical operation type represented by LogicalOperator
conditions
- LogicalExpression
instanceCopyright © 2003-2024 Appian Corporation. All Rights Reserved.