REQUESTBUILDER
- the type of a builder which can produce requests for a list operationREQUEST
- the type of a request to a list operation. This type must match the type
produced by REQUESTBUILDERRESPONSE
- the type of the response from a list operationpublic abstract class AbstractResponseIterator<REQUESTBUILDER,REQUEST,RESPONSE> extends Object
Contains common functionality for classes which will iterate over the results of paginated list operations in a service.
Modifier and Type | Field and Description |
---|---|
protected RESPONSE |
currentResponse
The most recent response/result of calling the list operation.
|
protected String |
nextPageToken
The page token to use on the next request to the list operation
|
protected Function<RESPONSE,String> |
nextPageTokenRetrievalFunction
A function which can be used to extract the next page token from a response from a list
operation
|
protected Function<REQUEST,RESPONSE> |
pageRetrievalFunction
A function which can call a list operation with a request and return the response from that
call
|
protected REQUESTBUILDER |
requestBuilder
A builder which can be used to construct requests to the list operation
|
protected Function<RequestBuilderAndToken<REQUESTBUILDER>,REQUEST> |
requestBuilderFunction
A function which constructs a request to a list operation based on a builder object and
pagination token
|
Constructor and Description |
---|
AbstractResponseIterator(REQUESTBUILDER requestBuilder,
Function<RESPONSE,String> nextPageTokenRetrievalFunction,
Function<RequestBuilderAndToken<REQUESTBUILDER>,REQUEST> requestBuilderFunction,
Function<REQUEST,RESPONSE> pageRetrievalFunction)
Constructs a new AbstractResponseIterator.
|
Modifier and Type | Method and Description |
---|---|
protected void |
fetchNextPage()
Updates the state of this class with the next page of results
|
protected Optional<String> |
getNextPageToken()
Gets the page token that should be used when the list operation is next called.
|
protected REQUEST |
getNextRequest()
Based on the state of this class, produces the next request that should be used when calling
the list operation so that the next page of results will be returned.
|
protected final REQUESTBUILDER requestBuilder
A builder which can be used to construct requests to the list operation
protected final Function<RESPONSE,String> nextPageTokenRetrievalFunction
A function which can be used to extract the next page token from a response from a list operation
protected final Function<REQUEST,RESPONSE> pageRetrievalFunction
A function which can call a list operation with a request and return the response from that call
protected final Function<RequestBuilderAndToken<REQUESTBUILDER>,REQUEST> requestBuilderFunction
A function which constructs a request to a list operation based on a builder object and pagination token
protected RESPONSE currentResponse
The most recent response/result of calling the list operation. If the operation has never been called, then this will be null
protected String nextPageToken
The page token to use on the next request to the list operation
public AbstractResponseIterator(REQUESTBUILDER requestBuilder, Function<RESPONSE,String> nextPageTokenRetrievalFunction, Function<RequestBuilderAndToken<REQUESTBUILDER>,REQUEST> requestBuilderFunction, Function<REQUEST,RESPONSE> pageRetrievalFunction)
Constructs a new AbstractResponseIterator.
requestBuilder
- a builder object which can create requests for a list operationnextPageTokenRetrievalFunction
- a function which can extract the next page token from a
response produced by a list operationrequestBuilderFunction
- a function which can build a request for a list operation based
on a builder object and a pagination token to usepageRetrievalFunction
- a function which will call a list operation with a request and
return the response of the callprotected REQUEST getNextRequest()
Based on the state of this class, produces the next request that should be used when calling the list operation so that the next page of results will be returned. This will just create the request and not make any service calls
protected Optional<String> getNextPageToken()
Gets the page token that should be used when the list operation is next called.
protected void fetchNextPage()
Updates the state of this class with the next page of results
Copyright © 2016–2024. All rights reserved.