Skip to main content

io.enterpriseai.Page

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/Page.java. Back to the Java SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class Page​

One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Constructor Page​

Page(List<T> items, String nextCursor, Function<String, Page<T>> fetcher)

Creates a page; the items are copied and an empty cursor becomes null.

NameTypeDefaultRequiredDescription
itemsList<T>yesItems of the page.
nextCursorStringyesnext_cursor of the following page, null or empty on the last page.
fetcherFunction<String, Page<T>>yesFunction that loads the page of a given cursor, called by next().

Page.autoPaging​

Iterable<T> autoPaging()

Iterates over every item of this page and of the following pages, fetching lazily.

This element takes no parameter.

Returns: Iterable<T>. An Iterable over every item; each following page is loaded only once the previous one is exhausted.

Raises: NoSuchElementException.

Page.hasNext​

boolean hasNext()

Tells whether a following page exists.

This element takes no parameter.

Returns: boolean. True when nextCursor() is not null.

Page.items​

List<T> items()

Items of this page only.

This element takes no parameter.

Returns: List<T>. An unmodifiable list of the items of the page.

Page.next​

Page<T> next()

Fetches the following page.

This element takes no parameter.

Returns: Page<T>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: NoSuchElementException.

Page.nextCursor​

String nextCursor()

Cursor of the following page.

This element takes no parameter.

Returns: String. The next_cursor cursor, or null on the last page.

Page.stream​

Stream<T> stream()

Lazy stream over every item of every page.

This element takes no parameter.

Returns: Stream<T>. An ordered Stream of every item, loading the following pages on demand.