Package com.google.api.gax.paging
Class AbstractPage<RequestT,ResponseT,ResourceT,PageT extends AbstractPage<RequestT,ResponseT,ResourceT,PageT>>
- java.lang.Object
-
- com.google.api.gax.paging.AbstractPage<RequestT,ResponseT,ResourceT,PageT>
-
- Direct Known Subclasses:
OperationsClient.ListOperationsPage
,OperationsClient.ListOperationsPage
public abstract class AbstractPage<RequestT,ResponseT,ResourceT,PageT extends AbstractPage<RequestT,ResponseT,ResourceT,PageT>> extends java.lang.Object implements AsyncPage<ResourceT>
Partial implementation ofAsyncPage
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPage(PageContext<RequestT,ResponseT,ResourceT> context, ResponseT response)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract PageT
createPage(PageContext<RequestT,ResponseT,ResourceT> context, ResponseT response)
com.google.api.core.ApiFuture<PageT>
createPageAsync(PageContext<RequestT,ResponseT,ResourceT> context, com.google.api.core.ApiFuture<ResponseT> futureResponse)
PageT
getNextPage()
Retrieves the next Page object using the next page token, ornull
if there are no more pages.PageT
getNextPage(int pageSize)
com.google.api.core.ApiFuture<PageT>
getNextPageAsync()
Returns a future for the Page object, retrieved using the next page token.java.lang.String
getNextPageToken()
Returns the next page token from the response, or an empty string if there are no more pages.int
getPageElementCount()
RequestT
getRequest()
ResponseT
getResponse()
java.lang.Iterable<ResourceT>
getValues()
Returns an iterable over the elements in this page.boolean
hasNextPage()
Returns true if there are more pages that can be retrieved from the API.java.lang.Iterable<ResourceT>
iterateAll()
Returns an iterable that traverses all of the elements of the underlying data source.
-
-
-
Constructor Detail
-
AbstractPage
protected AbstractPage(PageContext<RequestT,ResponseT,ResourceT> context, ResponseT response)
-
-
Method Detail
-
createPage
protected abstract PageT createPage(PageContext<RequestT,ResponseT,ResourceT> context, ResponseT response)
-
createPageAsync
@InternalApi("Visible for testing") public com.google.api.core.ApiFuture<PageT> createPageAsync(PageContext<RequestT,ResponseT,ResourceT> context, com.google.api.core.ApiFuture<ResponseT> futureResponse)
-
hasNextPage
public boolean hasNextPage()
Description copied from interface:Page
Returns true if there are more pages that can be retrieved from the API.- Specified by:
hasNextPage
in interfacePage<RequestT>
-
getNextPageToken
public java.lang.String getNextPageToken()
Description copied from interface:Page
Returns the next page token from the response, or an empty string if there are no more pages.- Specified by:
getNextPageToken
in interfacePage<RequestT>
-
getNextPage
public PageT getNextPage()
Description copied from interface:Page
Retrieves the next Page object using the next page token, ornull
if there are no more pages. The hasNextPage() method can be used to check if a Page object is available.- Specified by:
getNextPage
in interfacePage<RequestT>
-
getNextPage
public PageT getNextPage(int pageSize)
-
getNextPageAsync
public com.google.api.core.ApiFuture<PageT> getNextPageAsync()
Description copied from interface:AsyncPage
Returns a future for the Page object, retrieved using the next page token. If there are no more pages, returns a future which will immediately provide null. The hasNextPage() method can be used to check if a Page object is available.- Specified by:
getNextPageAsync
in interfaceAsyncPage<RequestT>
-
iterateAll
public java.lang.Iterable<ResourceT> iterateAll()
Description copied from interface:Page
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.- Specified by:
iterateAll
in interfacePage<RequestT>
-
getValues
public java.lang.Iterable<ResourceT> getValues()
Description copied from interface:Page
Returns an iterable over the elements in this page.
-
getResponse
public ResponseT getResponse()
-
getRequest
public RequestT getRequest()
-
getPageElementCount
public int getPageElementCount()
-
-