Package org.apache.cayenne.util
Class GenericResponse
java.lang.Object
org.apache.cayenne.util.GenericResponse
- All Implemented Interfaces:
- Serializable,- QueryResponse
A simple serializable implementation of QueryResponse.
- Since:
- 1.2
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an empty BaseResponse.GenericResponse(List<?> list) Creates a BaseResponse with a single result list.GenericResponse(QueryResponse response) Creates a response that it a shallow copy of another response.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddBatchUpdateCount(int[] resultCount) voidaddResultIterator(ResultIterator<?> iterator) voidaddResultList(List<?> list) voidaddUpdateCount(int resultCount) voidclear()Clears any previously collected information.Returns a current iterator.List<?>Returns a List under the current iterator position.int[]Returns an update count under the current iterator position.A utility method for quickly retrieving the Iterator in the response.List<?>A utility method for quickly retrieving the first list in the response.int[]A utility method for quickly retrieving the first update count from the response.booleanReturns whether current response is an iteratorbooleanisList()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.voidreplaceResult(Object oldResult, Object newResult) Replaces previously stored result with a new result.voidreset()Restarts response iterator.intsize()Returns a number of results in the response.
- 
Field Details- 
results
- 
currentIndexprotected transient int currentIndex
 
- 
- 
Constructor Details- 
GenericResponsepublic GenericResponse()Creates an empty BaseResponse.
- 
GenericResponseCreates a BaseResponse with a single result list.
- 
GenericResponseCreates a response that it a shallow copy of another response.
 
- 
- 
Method Details- 
firstListDescription 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 interface- QueryResponse
 
- 
firstIteratorDescription copied from interface:QueryResponseA utility method for quickly retrieving the Iterator in the response. Returns null if the query has no iterator.- Specified by:
- firstIteratorin interface- QueryResponse
 
- 
firstUpdateCountpublic int[] firstUpdateCount()Description copied from interface:QueryResponseA utility method for quickly retrieving the first update count from the response. Note that this method resets current iterator to an undefined state.- Specified by:
- firstUpdateCountin interface- QueryResponse
 
- 
currentListDescription 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 interface- QueryResponse
 
- 
currentIteratorDescription copied from interface:QueryResponseReturns a current iterator.- Specified by:
- currentIteratorin interface- QueryResponse
 
- 
currentUpdateCountpublic 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 interface- QueryResponse
 
- 
isListpublic boolean isList()Description copied from interface:QueryResponseReturns whether current iteration result is a list or an update count.- Specified by:
- isListin interface- QueryResponse
 
- 
isIteratorpublic boolean isIterator()Description copied from interface:QueryResponseReturns whether current response is an iterator- Specified by:
- isIteratorin interface- QueryResponse
 
- 
nextpublic boolean next()Description copied from interface:QueryResponseRewinds response iterator to the next result, returning true if it is available.- Specified by:
- nextin interface- QueryResponse
 
- 
resetpublic void reset()Description copied from interface:QueryResponseRestarts response iterator.- Specified by:
- resetin interface- QueryResponse
 
- 
sizepublic int size()Description copied from interface:QueryResponseReturns a number of results in the response.- Specified by:
- sizein interface- QueryResponse
 
- 
clearpublic void clear()Clears any previously collected information.
- 
addBatchUpdateCountpublic void addBatchUpdateCount(int[] resultCount) 
- 
addUpdateCountpublic void addUpdateCount(int resultCount) 
- 
addResultList
- 
addResultIterator- Parameters:
- iterator- to add as a result
- Since:
- 5.0
 
- 
replaceResultReplaces previously stored result with a new result.
 
-