Package org.eclipse.emf.cdo.view

## Interface CDOQuery

- All Superinterfaces:
    `CDOQueryInfo`

      public interface CDOQuery
      extends CDOQueryInfo

  Provides access to the information that specifies a query from a `view` to a `repository` and to the results of the remote query execution;
  Since:
    2.0
  Author:
    Simon McDuff
  No Implement
    This interface is not intended to be implemented by clients.
  No Extend
    This interface is not intended to be extended by clients.

- - ### Field Summary

    - ### Fields inherited from interface org.eclipse.emf.cdo.common.util.CDOQueryInfo

      `PARAM_DISABLE_RESPONSE_FLUSHING, UNLIMITED_RESULTS`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<T> java.util.List<T>` | `getResult()` | Same as `getResult(Class)` but tries to infer the return type from the static context.
    `<T> java.util.List<T>` | `getResult​(java.lang.Class<T> type)` | Sends this query to the server and returns a typed `list` containing the query result.
    `<T> org.eclipse.net4j.util.collection.CloseableIterator<T>` | `getResultAsync()` | Same as `getResultAsync(Class)` but tries to infer the return type from the static context.
    `<T> org.eclipse.net4j.util.collection.CloseableIterator<T>` | `getResultAsync​(java.lang.Class<T> classObject)` | Sends this query to the server and returns a typed `iterator` over the query result.
    `<T> T` | `getResultValue()` |
    `<T> T` | `getResultValue​(java.lang.Class<T> type)` |
    `CDOView` | `getView()` | Returns the `view` this query was created by and is associated with.
    `CDOQuery` | `setContext​(java.lang.Object object)` | Binds an object as the context for this query.
    `CDOQuery` | `setMaxResults​(int maxResults)` | Sets the maximum number of results to retrieve from the server.
    `CDOQuery` | `setParameter​(java.lang.String name, java.lang.Object value)` | Binds an argument value to a named parameter.
    `CDOQuery` | `unsetParameter​(java.lang.String name)` | Removes the value of a named parameter.

    - ### Methods inherited from interface org.eclipse.emf.cdo.common.util.CDOQueryInfo

      `getChangeSetData, getContext, getMaxResults, getParameter, getParameters, getQueryLanguage, getQueryString, isLegacyModeEnabled`

- - ### Method Detail

    - #### getView

          CDOView getView()

      Returns the `view` this query was created by and is associated with.
      Returns:
        Never `null`.

    - #### getResultAsync

          <T> org.eclipse.net4j.util.collection.CloseableIterator<T> getResultAsync​(java.lang.Class<T> classObject)

      Sends this query to the server and returns a typed `iterator` over the query result.

      As opposed to the `getResult(Class)` method, this method asynchronously communicates with the server. In other words, the returned iterator can be used immediately, even if the server is still about to send pending result elements.

    - #### getResultAsync

          <T> org.eclipse.net4j.util.collection.CloseableIterator<T> getResultAsync()

      Same as `getResultAsync(Class)` but tries to infer the return type from the static context.
      Since:
        4.0

    - #### getResult

          <T> java.util.List<T> getResult​(java.lang.Class<T> type)

      Sends this query to the server and returns a typed `list` containing the query result.

      As opposed to the `getResultAsync(Class)` method, this method synchronously communicates with the server. In other words, the result list is only returned after all result elements have been received by the client.

    - #### getResult

          <T> java.util.List<T> getResult()

      Same as `getResult(Class)` but tries to infer the return type from the static context.
      Since:
        4.0

    - #### getResultValue

          <T> T getResultValue​(java.lang.Class<T> type)

      Since:
        4.2

    - #### getResultValue

          <T> T getResultValue()

      Since:
        4.2

    - #### setMaxResults

          CDOQuery setMaxResults​(int maxResults)

      Sets the maximum number of results to retrieve from the server.
      Parameters:
        `maxResults` - the maximum number of results to retrieve or `CDOQueryInfo.UNLIMITED_RESULTS` for no limitation.
      Returns:
        the same query instance.

    - #### setParameter

          CDOQuery setParameter​(java.lang.String name,
                                java.lang.Object value)

      Binds an argument value to a named parameter.
      Parameters:
        `name` - the parameter name
        `value` - the value to bind
      Returns:
        the same query instance
      Throws:
        `java.lang.IllegalArgumentException` - if the parameter name does not correspond to a parameter in the query string or if the argument value is of incorrect type

    - #### unsetParameter

          CDOQuery unsetParameter​(java.lang.String name)

      Removes the value of a named parameter.
      Parameters:
        `name` - the parameter name
      Returns:
        the same query instance
      Since:
        4.6

    - #### setContext

          CDOQuery setContext​(java.lang.Object object)

      Binds an object as the context for this query.
      Since:
        4.0