Interface AnyPage

All Superinterfaces:
SearchPagination<AnyPage>
All Known Implementing Classes:
AnyPageImpl

public interface AnyPage extends SearchPagination<AnyPage>
All pagination models combined, supporting offset, limit, and cursor-based (forward/backward) pagination.

Use this for search endpoints that support any pagination model. Calling a direction method (from, after, before) locks the pagination style by returning a style-specific interface, so incompatible methods cannot be chained:

  • Limit only: limit(10) — stays on AnyPage
  • Offset-based: from(20).limit(10) — returns OffsetPage
  • Cursor forward: after("cursor").limit(10) — returns CursorForwardPage
  • Cursor backward: before("cursor").limit(10) — returns CursorBackwardPage

Mixing pagination styles (e.g., from(10).after("cursor")) is prevented at compile-time because the returned interface does not expose the incompatible method.

  • Method Details

    • from

      OffsetPage from(Integer value)
      Start the page from the given offset (0-based index). Locks pagination to offset-based, returning an OffsetPage that only exposes from and limit.
    • limit

      AnyPage limit(Integer value)
      Limit the number of returned entities.
    • before

      CursorBackwardPage before(String cursor)
      Get previous page before the cursor. Locks pagination to cursor-backward, returning a CursorBackwardPage that only exposes before and limit.
    • after

      CursorForwardPage after(String cursor)
      Get next page after the cursor. Locks pagination to cursor-forward, returning a CursorForwardPage that only exposes after and limit.