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, PARAM_DISABLE_RESPONSE_TIMEOUT, UNLIMITED_RESULTS`

## Method Summary

Modifier and Type
Method
Description
`<T> List<T>`
`getResult()`
Same as `getResult(Class)` but tries to infer the return type from the static context.
`<T> List<T>`
`getResult(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(Class<T> classObject)`
Sends this query to the server and returns a typed `iterator` over the query result.
`<T> T`
`getResultValue()`
`<T> T`
`getResultValue(Class<T> type)`
`CDOView`
`getView()`
Returns the `view` this query was created by and is associated with.
`CDOQuery`
`setContext(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(String name, Object value)`
Binds an argument value to a named parameter.
`CDOQuery`
`unsetParameter(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 Details

### 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(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> List<T> getResult(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> 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(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(String name, 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:
  `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(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(Object object)
Binds an object as the context for this query.

Since:
  4.0