Interface AnyPage
- All Superinterfaces:
SearchPagination<AnyPage>
- All Known Implementing Classes:
AnyPageImpl
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 onAnyPage - Offset-based:
from(20).limit(10)— returnsOffsetPage - Cursor forward:
after("cursor").limit(10)— returnsCursorForwardPage - Cursor backward:
before("cursor").limit(10)— returnsCursorBackwardPage
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 Summary
Modifier and TypeMethodDescriptionGet next page after the cursor.Get previous page before the cursor.Start the page from the given offset (0-based index).Limit the number of returned entities.
-
Method Details
-
from
Start the page from the given offset (0-based index). Locks pagination to offset-based, returning anOffsetPagethat only exposesfromandlimit. -
limit
Limit the number of returned entities. -
before
Get previous page before the cursor. Locks pagination to cursor-backward, returning aCursorBackwardPagethat only exposesbeforeandlimit. -
after
Get next page after the cursor. Locks pagination to cursor-forward, returning aCursorForwardPagethat only exposesafterandlimit.
-