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

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

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

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

Direct Known Subclasses:
  JcrSelectQuery

    @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)`
`int` | `hashCode()`
`boolean` | `isDistinct()` Determine whether this query is to return only distinct values.
`Limit` | `limits()` Get the limits associated with this query.
`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

### limits

    public Limit limits()

  Get the limits associated with this query.

  Specified by:
    `limits` in interface `QueryCommand`
  Returns:
    the limits; never null but possibly `unlimited`
  See Also:
    `QueryCommand.limits()`

### orderings

    public List<? extends Ordering> orderings()

  Return the orderings for this query.

  Specified by:
    `orderings` in interface `QueryCommand`
  Returns:
    the list of orderings; never null
  See Also:
    `QueryCommand.orderings()`

### 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()

  Return the columns defining the query results. If there are no columns, then the columns are implementation determined.

  Specified by:
    `columns` in interface `QueryCommand`
  Returns:
    the list of columns; never null
  See Also:
    `QueryCommand.columns()`

### 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)

  Create a copy of this query, but one that uses the supplied limit on the number of result rows.

  Specified by:
    `withLimit` in interface `QueryCommand`
  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
  See Also:
    `QueryCommand.withLimit(int)`

### withOffset

    public Query withOffset(int offset)

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

  Specified by:
    `withOffset` in interface `QueryCommand`
  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
  See Also:
    `QueryCommand.withOffset(int)`

### 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`
  See Also:
    `Object.toString()`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(java.lang.Object)`

### accept

    public void accept(Visitor visitor)

  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
  See Also:
    `Visitable.accept(org.modeshape.graph.query.model.Visitor)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
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.