Package com.google.api.gax.paging
Class AbstractPagedListResponse<RequestT,ResponseT,ResourceT,PageT extends AbstractPage<RequestT,ResponseT,ResourceT,PageT>,CollectionT extends AbstractFixedSizeCollection<RequestT,ResponseT,ResourceT,PageT,CollectionT>>
- java.lang.Object
-
- com.google.api.gax.paging.AbstractPagedListResponse<RequestT,ResponseT,ResourceT,PageT,CollectionT>
-
- All Implemented Interfaces:
PagedListResponse<ResourceT>
- Direct Known Subclasses:
OperationsClient.ListOperationsPagedResponse
,OperationsClient.ListOperationsPagedResponse
public abstract class AbstractPagedListResponse<RequestT,ResponseT,ResourceT,PageT extends AbstractPage<RequestT,ResponseT,ResourceT,PageT>,CollectionT extends AbstractFixedSizeCollection<RequestT,ResponseT,ResourceT,PageT,CollectionT>> extends java.lang.Object implements PagedListResponse<ResourceT>
Partial implementation ofPagedListResponse
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPagedListResponse(PageT page, CollectionT emptyCollection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CollectionT
expandToFixedSizeCollection(int collectionSize)
Returns a collection of elements with a fixed size set by the collectionSize parameter.java.lang.String
getNextPageToken()
Returns the token for the next page or an empty string if no more results.PageT
getPage()
Returns the current page of results.java.lang.Iterable<ResourceT>
iterateAll()
Returns an iterable that traverses all of the elements of the underlying data source.java.lang.Iterable<CollectionT>
iterateFixedSizeCollections(int collectionSize)
Returns an iterable over fixed size collections of results.java.lang.Iterable<PageT>
iteratePages()
Return an iterable over all Page objects.
-
-
-
Constructor Detail
-
AbstractPagedListResponse
protected AbstractPagedListResponse(PageT page, CollectionT emptyCollection)
-
-
Method Detail
-
iterateAll
public java.lang.Iterable<ResourceT> iterateAll()
Description copied from interface:PagedListResponse
Returns an iterable that traverses all of the elements of the underlying data source. The data is fetched lazily page by page, where each page may contain multiple elements. A new page is fetched whenever the elements of any particular page are exhausted. This method is not thread-safe.- Specified by:
iterateAll
in interfacePagedListResponse<RequestT>
-
getPage
public PageT getPage()
Description copied from interface:PagedListResponse
Returns the current page of results. Note: This method is not thread-safe.- Specified by:
getPage
in interfacePagedListResponse<RequestT>
-
iteratePages
public java.lang.Iterable<PageT> iteratePages()
Description copied from interface:PagedListResponse
Return an iterable over all Page objects. Page objects are retrieved lazily via API calls until all elements have been retrieved.- Specified by:
iteratePages
in interfacePagedListResponse<RequestT>
-
getNextPageToken
public java.lang.String getNextPageToken()
Description copied from interface:PagedListResponse
Returns the token for the next page or an empty string if no more results. Note: This method is not thread-safe.- Specified by:
getNextPageToken
in interfacePagedListResponse<RequestT>
-
expandToFixedSizeCollection
public CollectionT expandToFixedSizeCollection(int collectionSize)
Description copied from interface:PagedListResponse
Returns a collection of elements with a fixed size set by the collectionSize parameter. The collection will only contain fewer than collectionSize elements if there are no more pages to be retrieved from the server.NOTE: it is an error to call this method if the optional parameter 'page_size' has not been set in the original API call. It is also an error if the collectionSize parameter is less than the page_size.
- Specified by:
expandToFixedSizeCollection
in interfacePagedListResponse<RequestT>
-
iterateFixedSizeCollections
public java.lang.Iterable<CollectionT> iterateFixedSizeCollections(int collectionSize)
Description copied from interface:PagedListResponse
Returns an iterable over fixed size collections of results. The collections are retrieved lazily from the underlying API.Each collection will have collectionSize elements, with the exception of the final collection which may contain fewer elements.
NOTE: it is an error to call this method if the optional parameter 'page_size' has not been set in the original API call. It is also an error if the collectionSize parameter is less than the page_size.
- Specified by:
iterateFixedSizeCollections
in interfacePagedListResponse<RequestT>
-
-