org.modeshape.jcr.query.model

## Class SelectQuery

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

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

      public class SelectQuery
      extends Query
      implements SelectQuery

  An implementation of `SelectQuery`.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.modeshape.jcr.query.model.Query

      `IS_DISTINCT_DEFAULT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SelectQuery(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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Constraint` | `getConstraint()` Gets the constraint for this query.
    `Source` | `getSource()` Gets the node-tuple source for this query.
    `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 org.modeshape.jcr.query.model.Query

      `accept, adding, adding, columns, constrainedBy, constraint, distinct, equals, getColumns, getLimits, getOrderings, hashCode, isDistinct, noDistinct, orderedBy, orderings, returning, source, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.modeshape.jcr.api.query.qom.QueryCommand

      `getColumns, getLimits, getOrderings`

- - ### Constructor Detail

    - #### SelectQuery

          public SelectQuery(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

    - #### getConstraint

          public Constraint getConstraint()

      Description copied from interface: `SelectQuery`
      Gets the constraint for this query.
      Specified by:
        `getConstraint` in interface `SelectQuery`
      Returns:
        the constraint, or null if none

    - #### getSource

          public Source getSource()

      Description copied from interface: `SelectQuery`
      Gets the node-tuple source for this query.
      Specified by:
        `getSource` in interface `SelectQuery`
      Returns:
        the node-tuple source; non-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.
      Overrides:
        `withLimit` in class `Query`
      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.
      Overrides:
        `withOffset` in class `Query`
      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

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