V - type of resource being iterated overpublic class PageIterator<V>
extends java.lang.Object
implements java.util.Iterator<java.util.Collection<V>>, java.lang.Iterable<java.util.Collection<V>>
next() will make
a client request for the next page of resources using the URI returned from
the previous request.
The hasNext() method can be used to determine if the last executed
request contained the location of the next page of results.
This iterator also provides the next and last page numbers as well as the
next and last URIs.| Modifier and Type | Field and Description |
|---|---|
protected GitHubClient |
client
Client
|
protected java.lang.String |
last
Last uri to be fetched
|
protected int |
lastPage
Last page number
|
protected java.lang.String |
next
Next uri to be fetched
|
protected int |
nextPage
Current page number
|
protected PagedRequest<V> |
request
Request
|
| Constructor and Description |
|---|
PageIterator(PagedRequest<V> request,
GitHubClient client)
Create page iterator
|
| Modifier and Type | Method and Description |
|---|---|
int |
getLastPage()
Get number of last page
|
java.lang.String |
getLastUri()
Get uri of last page
|
int |
getNextPage()
Get number of next page to be read
|
java.lang.String |
getNextUri()
Get URI of next request
|
PagedRequest<V> |
getRequest()
Get request being executed
|
boolean |
hasNext() |
java.util.Iterator<java.util.Collection<V>> |
iterator() |
java.util.Collection<V> |
next() |
protected int |
parsePageNumber(java.lang.String uri)
Parse page number from uri
|
void |
remove() |
protected final PagedRequest<V> request
protected final GitHubClient client
protected int nextPage
protected int lastPage
protected java.lang.String next
protected java.lang.String last
public PageIterator(PagedRequest<V> request, GitHubClient client)
request - client - protected int parsePageNumber(java.lang.String uri)
uri - public int getNextPage()
public int getLastPage()
public java.lang.String getNextUri()
public java.lang.String getLastUri()
public boolean hasNext()
hasNext in interface java.util.Iterator<java.util.Collection<V>>public void remove()
remove in interface java.util.Iterator<java.util.Collection<V>>public java.util.Collection<V> next()
next in interface java.util.Iterator<java.util.Collection<V>>public PagedRequest<V> getRequest()