Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.model
Class Query

    java.lang.Object
      org.modeshape.jcr.query.model.Query

All Implemented Interfaces:
  Serializable, QueryCommand, Command, LanguageObject, Visitable

Direct Known Subclasses:
  SelectQuery

    @Immutable
    public class Query

extends Object
implements QueryCommand

See Also:
  Serialized Form

Field Summary
`static boolean` | `IS_DISTINCT_DEFAULT`

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### IS_DISTINCT_DEFAULT

    public static final boolean IS_DISTINCT_DEFAULT

See Also:
  Constant Field Values

Constructor Detail

### Query

    public Query(Source source)

  Create a new query that uses the supplied source.

  Parameters:
    `source` - the source
  Throws:
    `IllegalArgumentException` - if the source is null

### Query

    public 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.

  Parameters:
    `source` - the source
    `constraint` - the constraint (or composite constraint), or null or empty if there are no constraints
    `orderings` - the specifications of how the results are to be ordered, or null if the order is to be implementation determined
    `columns` - 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 determiend
    `limit` - the limit for the results, or null if all of the results are to be included
    `isDistinct` - true if duplicates are to be removed from the results
  Throws:
    `IllegalArgumentException` - if the source is null

Method Detail

### getLimits

    public Limit getLimits()

  Description copied from interface: `QueryCommand`
  Get the limits associated with this query.

  Specified by:
    `getLimits` in interface `QueryCommand`
  Returns:
    the limits; never null but possibly `unlimited`

### orderings

    public List<? extends Ordering> orderings()

  Description copied from interface: `QueryCommand`
  Return the orderings for this query.

  Returns:
    the list of orderings; never null

### source

    public Source source()

  Get the source for the results.

  Returns:
    the query source; never null

### constraint

    public Constraint constraint()

  Get the constraints, if there are any.

  Returns:
    the constraint; may be null

### columns

    public List<? extends Column> columns()

  Description copied from interface: `QueryCommand`
  Return the columns defining the query results. If there are no columns, then the columns are implementation determined.

  Returns:
    the list of columns; never null

### getOrderings

    public Ordering[] getOrderings()

  Description copied from interface: `QueryCommand`
  Gets the orderings for this query.

  Specified by:
    `getOrderings` in interface `QueryCommand`
  Returns:
    an array of zero or more orderings; non-null

### getColumns

    public Column[] getColumns()

  Description copied from interface: `QueryCommand`
  Gets the columns for this query.

  Specified by:
    `getColumns` in interface `QueryCommand`
  Returns:
    an array of zero or more columns; non-null

### isDistinct

    public boolean isDistinct()

  Determine whether this query is to return only distinct values.

  Returns:
    true if the query is to remove duplicate tuples, or false otherwise

### distinct

    public Query distinct()

  Create a copy of this query, but one in which there are no duplicate rows in the results.

  Returns:
    the copy of the query with no duplicate result rows; never null

### noDistinct

    public Query noDistinct()

  Create a copy of this query, but one in which there may be duplicate rows in the results.

  Returns:
    the copy of the query with potentially duplicate result rows; never null

### constrainedBy

    public Query constrainedBy(Constraint constraint)

  Create a copy of this query, but one that uses the supplied constraint.

  Parameters:
    `constraint` - the constraint that should be used; never null
  Returns:
    the copy of the query that uses the supplied constraint; never null

### orderedBy

    public Query orderedBy(List<Ordering> orderings)

  Create a copy of this query, but one whose results should be ordered by the supplied orderings.

  Parameters:
    `orderings` - the result ordering specification that should be used; never null
  Returns:
    the copy of the query that uses the supplied ordering; never null

### withLimit

    public Query withLimit(int rowLimit)

  Description copied from interface: `QueryCommand`
  Create a copy of this query, but one that uses the supplied limit on the number of result rows.

  Parameters:
    `rowLimit` - the limit that should be used; must be a positive number
  Returns:
    the copy of the query that uses the supplied limit; never null

### withOffset

    public Query withOffset(int offset)

  Description copied from interface: `QueryCommand`
  Create a copy of this query, but one that uses the supplied offset.

  Parameters:
    `offset` - the limit that should be used; may not be negative
  Returns:
    the copy of the query that uses the supplied offset; never null

### returning

    public Query returning(List<Column> columns)

  Create a copy of this query, but that returns results with the supplied columns.

  Parameters:
    `columns` - the columns of the results; may not be null
  Returns:
    the copy of the query returning the supplied result columns; never null

### adding

    public 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.

  Parameters:
    `orderings` - the additional orderings of the result rows; may no be null
  Returns:
    the copy of the query returning the supplied result columns; never null

### adding

    public 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.

  Parameters:
    `columns` - the additional columns that should be included in the the results; may not be null
  Returns:
    the copy of the query returning the supplied result columns; never null

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### accept

    public void accept(Visitor visitor)

  Description copied from interface: `Visitable`
  Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.

  Specified by:
    `accept` in interface `Visitable`
  Parameters:
    `visitor` - the visitor; never null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.