@Immutable public class Query extends Object implements QueryCommand
Modifier and Type | Field and Description |
---|---|
static boolean |
IS_DISTINCT_DEFAULT |
Constructor and Description |
---|
Query(Source source)
Create a new query that uses the supplied source.
|
Query(Source source,
Constraint constraint,
List<? extends Ordering> orderings,
List<? extends Column> columns,
Limit limit,
boolean isDistinct)
Create a new query that uses the supplied source, constraint, orderings, columns and limits.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.
|
Query |
adding(Column... columns)
Create a copy of this query, but that returns results that include the columns specified by this query as well as the
supplied columns.
|
Query |
adding(Ordering... orderings)
Create a copy of this query, but that returns results that are ordered by the
orderings of this column
as well as those supplied. |
List<? extends Column> |
columns()
Return the columns defining the query results.
|
Query |
constrainedBy(Constraint constraint)
Create a copy of this query, but one that uses the supplied constraint.
|
Constraint |
constraint()
Get the constraints, if there are any.
|
Query |
distinct()
Create a copy of this query, but one in which there are no duplicate rows in the results.
|
boolean |
equals(Object obj) |
Column[] |
getColumns()
Gets the columns for this query.
|
Limit |
getLimits()
Get the limits associated with this query.
|
Ordering[] |
getOrderings()
Gets the orderings for this query.
|
int |
hashCode() |
boolean |
isDistinct()
Determine whether this query is to return only distinct values.
|
Query |
noDistinct()
Create a copy of this query, but one in which there may be duplicate rows in the results.
|
Query |
orderedBy(List<Ordering> orderings)
Create a copy of this query, but one whose results should be ordered by the supplied orderings.
|
List<? extends Ordering> |
orderings()
Return the orderings for this query.
|
Query |
returning(List<Column> columns)
Create a copy of this query, but that returns results with the supplied columns.
|
Source |
source()
Get the source for the results.
|
String |
toString() |
Query |
withLimit(int rowLimit)
Create a copy of this query, but one that uses the supplied limit on the number of result rows.
|
Query |
withOffset(int offset)
Create a copy of this query, but one that uses the supplied offset.
|
public static final boolean IS_DISTINCT_DEFAULT
public Query(Source source)
source
- the sourceIllegalArgumentException
- if the source is nullpublic Query(Source source, Constraint constraint, List<? extends Ordering> orderings, List<? extends Column> columns, Limit limit, boolean isDistinct)
source
- the sourceconstraint
- the constraint (or composite constraint), or null or empty if there are no constraintsorderings
- the specifications of how the results are to be ordered, or null if the order is to be implementation
determinedcolumns
- the columns to be included in the results, or null or empty if there are no explicit columns and the actual
result columns are to be implementation determiendlimit
- the limit for the results, or null if all of the results are to be includedisDistinct
- true if duplicates are to be removed from the resultsIllegalArgumentException
- if the source is nullpublic Limit getLimits()
QueryCommand
getLimits
in interface QueryCommand
unlimited
public List<? extends Ordering> orderings()
QueryCommand
public Source source()
public Constraint constraint()
public List<? extends Column> columns()
QueryCommand
public Ordering[] getOrderings()
QueryCommand
getOrderings
in interface QueryCommand
public Column[] getColumns()
QueryCommand
getColumns
in interface QueryCommand
public boolean isDistinct()
public Query distinct()
public Query noDistinct()
public Query constrainedBy(Constraint constraint)
constraint
- the constraint that should be used; never nullpublic Query orderedBy(List<Ordering> orderings)
orderings
- the result ordering specification that should be used; never nullpublic Query withLimit(int rowLimit)
QueryCommand
rowLimit
- the limit that should be used; must be a positive numberpublic Query withOffset(int offset)
QueryCommand
offset
- the limit that should be used; may not be negativepublic Query returning(List<Column> columns)
columns
- the columns of the results; may not be nullpublic Query adding(Ordering... orderings)
orderings
of this column
as well as those supplied.orderings
- the additional orderings of the result rows; may no be nullpublic Query adding(Column... columns)
columns
- the additional columns that should be included in the the results; may not be nullCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.