Class PagedIterable<T>
- java.lang.Object
-
- com.azure.android.core.rest.util.paging.PagedIterable<T>
-
- Type Parameters:
T
- The type of page elements contained in thisPagedIterable
.
- All Implemented Interfaces:
java.lang.Iterable<T>
public class PagedIterable<T> extends java.lang.Object implements java.lang.Iterable<T>
PagedIterable provides the ability to enumerate paginated REST responses of typePagedResponse
and individual elements in such pages usingIterable
interface. When processing the response by page each response will contain the elements in the page as well as the REST response details such as status code and headers.
-
-
Constructor Summary
Constructors Constructor Description PagedIterable(com.azure.android.core.util.Function<java.lang.String,PagedResponse<T>> pageRetriever, com.azure.android.core.util.Predicate<java.lang.String> continuationPredicate, com.azure.android.core.logging.ClientLogger logger)
Creates an instance ofPagedIterable
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<PagedResponse<T>>
byPage()
Gets aIterable
ofPagedResponse
starting at the first page.java.lang.Iterable<PagedResponse<T>>
byPage(java.lang.String startPageId)
Gets aIterable
ofPagedResponse
beginning at the page identified by the given token.PagedResponse<T>
getPage(java.lang.String pageId)
Retrieve a page with given idpageId
.java.util.Iterator<T>
iterator()
java.util.Iterator<T>
iterator(java.lang.String startPageId)
Gets aIterable
ofPagedIterable
beginning at the page identified by the given token.
-
-
-
Constructor Detail
-
PagedIterable
public PagedIterable(com.azure.android.core.util.Function<java.lang.String,PagedResponse<T>> pageRetriever, com.azure.android.core.util.Predicate<java.lang.String> continuationPredicate, com.azure.android.core.logging.ClientLogger logger)
Creates an instance ofPagedIterable
.- Parameters:
pageRetriever
- The page retriever.continuationPredicate
- A predicate which determines if paging should continue.logger
- The logger to log.
-
-
Method Detail
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
byPage
public java.lang.Iterable<PagedResponse<T>> byPage()
Gets aIterable
ofPagedResponse
starting at the first page.- Returns:
- A
Iterable
ofPagedResponse
.
-
byPage
public java.lang.Iterable<PagedResponse<T>> byPage(java.lang.String startPageId)
Gets aIterable
ofPagedResponse
beginning at the page identified by the given token.- Parameters:
startPageId
- A continuation token identifying the page to select.- Returns:
- A
Iterable
ofPagedResponse
.
-
iterator
public java.util.Iterator<T> iterator(java.lang.String startPageId)
Gets aIterable
ofPagedIterable
beginning at the page identified by the given token.- Parameters:
startPageId
- A continuation token identifying the page to select.- Returns:
- A
Iterable
ofPagedIterable
.
-
getPage
public PagedResponse<T> getPage(java.lang.String pageId)
Retrieve a page with given idpageId
. Anull
value forpageId
indicate the initial page.- Parameters:
pageId
- The id of the page to retrieve.- Returns:
- The page with given id.
-
-