Package com.fauna.client
Class PageIterator<E>
- java.lang.Object
-
- com.fauna.client.PageIterator<E>
-
-
Constructor Summary
Constructors Constructor Description PageIterator(FaunaClient client, Query fql, java.lang.Class<E> resultClass, QueryOptions options)
Construct a new PageIterator.PageIterator(FaunaClient client, Page<E> firstPage, java.lang.Class<E> resultClass, QueryOptions options)
Construct a new PageIterator starting from a given page.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Query
buildPageQuery(AfterToken afterToken)
Build the page query with a specific AfterToken.java.util.Iterator<E>
flatten()
Return an iterator that iterates directly over the items that make up the page contents.boolean
hasNext()
Check if there is a next page available.Page<E>
next()
Get the next Page.java.util.concurrent.CompletableFuture<Page<E>>
nextAsync()
Returns a CompletableFuture that will complete with the next page (or throw a FaunaException).
-
-
-
Constructor Detail
-
PageIterator
public PageIterator(FaunaClient client, Query fql, java.lang.Class<E> resultClass, QueryOptions options)
Construct a new PageIterator.- Parameters:
client
- A client that makes requests to Fauna.fql
- The FQL query.resultClass
- The class of the elements returned from Fauna (i.e., the rows).options
- (optionally) pass in QueryOptions.
-
PageIterator
public PageIterator(FaunaClient client, Page<E> firstPage, java.lang.Class<E> resultClass, QueryOptions options)
Construct a new PageIterator starting from a given page.- Parameters:
client
- A client that makes requests to Fauna.firstPage
- The first Page of elements.resultClass
- The class of the elements returned from Fauna (i.e., the rows).options
- (optionally) pass in QueryOptions.
-
-
Method Detail
-
hasNext
public boolean hasNext()
Check if there is a next page available.- Specified by:
hasNext
in interfacejava.util.Iterator<E>
- Returns:
- True if there is a next page, false otherwise.
-
buildPageQuery
public static Query buildPageQuery(AfterToken afterToken)
Build the page query with a specific AfterToken.- Parameters:
afterToken
- The token indicating where the next page should start.- Returns:
- A Query to fetch the next page.
-
nextAsync
public java.util.concurrent.CompletableFuture<Page<E>> nextAsync()
Returns a CompletableFuture that will complete with the next page (or throw a FaunaException).- Returns:
- A CompletableFuture representing the next page of elements.
-
next
public Page<E> next()
Get the next Page.- Specified by:
next
in interfacejava.util.Iterator<E>
- Returns:
- The next Page of elements E.
- Throws:
FaunaException
- If there is an error getting the next page.
-
flatten
public java.util.Iterator<E> flatten()
Return an iterator that iterates directly over the items that make up the page contents.- Returns:
- An iterator of E.
-
-