public interface QueryResponse
An example of iterating through a response:
QueryResponse response = context.performGenericQuery(query); for (response.reset(); response.next();) { if (response.isList()) { List list = response.currentList(); // ... } else { int[] updateCounts = response.currentUpdateCount(); // ... } }
In case the structure of the result is known, and only a single list or an update count is expected, there is a simpler API to access them:
QueryResponse response = context.performGenericQuery(query); List list = response.firstList(); int[] count = response.firstUpdateCount();
Modifier and Type | Method and Description |
---|---|
List<?> |
currentList()
Returns a List under the current iterator position.
|
int[] |
currentUpdateCount()
Returns an update count under the current iterator position.
|
List |
firstList()
A utility method for quickly retrieving the first list in the response.
|
int[] |
firstUpdateCount()
A utility method for quickly retrieving the first update count from the response.
|
boolean |
isList()
Returns whether current iteration result is a list or an update count.
|
boolean |
next()
Rewinds response iterator to the next result, returning true if it is available.
|
void |
reset()
Restarts response iterator.
|
int |
size()
Returns a number of results in the response.
|
int size()
boolean isList()
List<?> currentList()
isList()
to check
the result type before calling this method.int[] currentUpdateCount()
isList()
to check the result type before calling this
method.boolean next()
void reset()
List firstList()
int[] firstUpdateCount()
Copyright © 2001–2017 Apache Cayenne. All rights reserved.