Page

One page of results that can iterate through every later page.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.24+fa54770
public final class Page<T> implements Iterable<T>

One page of results that can iterate through every later page.

Iterating loads the next pages on demand:

for (JsonNode patient : ovok.slim().patients().list(Map.of(), RequestOptions.defaults())) {
    System.out.println(patient.path("id").asString());
}

Type parameters:

  • <T>: the item type

Methods

data

public List<T> data()

Returns the items on this page only.

Returns: the items

hasMore

public boolean hasMore()

Returns whether a later page exists.

Returns: true if a later page exists

total

public Long total()

Returns the total item count across all pages, when the server reports it.

Returns: the total, or null if unknown

iterator

public Iterator<T> iterator()

Iterates this page's items, then every later page's items.

Returns: the iterator

numbered

public static Page<JsonNode> numbered(Function<Integer, JsonNode> load, int firstPage)

Pages a page-numbered response (resources, page, count, total).

Parameters:

  • load: loads the response for a page number
  • firstPage: the first page number

Returns: the first page

cursor

public static Page<JsonNode> cursor(Function<String, JsonNode> load)

Pages a cursor response (items, nextCursor).

Parameters:

  • load: loads the response for a cursor; the first call gets null

Returns: the first page

payload

public static Page<JsonNode> payload(Function<Integer, JsonNode> load, Integer firstPage)

Pages a Payload CMS response (docs, nextPage, totalDocs).

Parameters:

  • load: loads the response for a page number
  • firstPage: the first page number, or null for the server default

Returns: the first page

Last updated on

On this page