Package org.apache.cayenne.util
Class ListResponse
java.lang.Object
org.apache.cayenne.util.ListResponse
- All Implemented Interfaces:
Serializable,QueryResponse
- Direct Known Subclasses:
IncrementalListResponse
A QueryResponse optimized to hold a single object or data row list.
- Since:
- 1.2
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty response.ListResponse(Object object) ListResponse(List<?> objectList) -
Method Summary
Modifier and TypeMethodDescriptionList<?>Returns a List under the current iterator position.int[]Returns an update count under the current iterator position.List<?>A utility method for quickly retrieving the first list in the response.booleanisList()Returns whether current iteration result is a list or an update count.booleannext()Rewinds response iterator to the next result, returning true if it is available.voidreset()Restarts response iterator.intsize()Returns a number of results in the response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cayenne.QueryResponse
currentIterator, firstIterator, firstUpdateCount, isIterator
-
Field Details
-
objectList
-
currentIndex
protected transient int currentIndex
-
-
Constructor Details
-
ListResponse
public ListResponse()Creates an empty response. -
ListResponse
-
ListResponse
-
-
Method Details
-
size
public int size()Description copied from interface:QueryResponseReturns a number of results in the response.- Specified by:
sizein interfaceQueryResponse
-
isList
public boolean isList()Description copied from interface:QueryResponseReturns whether current iteration result is a list or an update count.- Specified by:
isListin interfaceQueryResponse
-
currentList
Description copied from interface:QueryResponseReturns a List under the current iterator position. UseQueryResponse.isList()to check the result type before calling this method.- Specified by:
currentListin interfaceQueryResponse
-
currentUpdateCount
public int[] currentUpdateCount()Description copied from interface:QueryResponseReturns an update count under the current iterator position. Returned value is an int[] to accommodate batch queries. For a regular update result, the value will be an int[1]. UseQueryResponse.isList()to check the result type before calling this method.- Specified by:
currentUpdateCountin interfaceQueryResponse
-
next
public boolean next()Description copied from interface:QueryResponseRewinds response iterator to the next result, returning true if it is available.- Specified by:
nextin interfaceQueryResponse
-
reset
public void reset()Description copied from interface:QueryResponseRestarts response iterator.- Specified by:
resetin interfaceQueryResponse
-
firstList
Description copied from interface:QueryResponseA utility method for quickly retrieving the first list in the response. Returns null if the query has no lists. Note that this method resets current iterator to an undefined state.- Specified by:
firstListin interfaceQueryResponse
-