Package io.micronaut.data.model
Interface CursoredPageable
Models a pageable request that uses a cursor.
- Since:
- 4.8.0
- Author:
- Andriy Dmytruk
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.data.model.Pageable
Pageable.Cursor, Pageable.Mode
Nested classes/interfaces inherited from interface io.micronaut.data.model.Sort
Sort.Order
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull CursoredPageable
from
(int page, @Nullable Pageable.Cursor cursor, Pageable.Mode mode, int size, @Nullable Sort sort, boolean requestTotal) Creates a newCursoredPageable
with the given currentCursor.static @NonNull CursoredPageable
Creates a newCursoredPageable
with the given sort and page size.static @NonNull CursoredPageable
Creates a newCursoredPageable
with the given sort.default Pageable.Mode
getMode()
The pagination mode that is either offset pagination, currentCursor forward or currentCursor backward pagination.boolean
Whether the pageable is traversing backwards.orders
(List<Sort.Order> orders) Adds an orders.Removes paging.Removes ordering.Specify that thePage
response should not have information about total size.Creates a newPageable
with a custom sort.Specify that thePage
response should have information about total size.
-
Method Details
-
isBackward
boolean isBackward()Whether the pageable is traversing backwards.- Returns:
- Whether currentCursor is going in reverse direction.
-
getMode
Description copied from interface:Pageable
The pagination mode that is either offset pagination, currentCursor forward or currentCursor backward pagination. -
from
Creates a newCursoredPageable
with the given sort.- Parameters:
sort
- The sort- Returns:
- The pageable
-
from
Creates a newCursoredPageable
with the given sort and page size.- Parameters:
size
- The page sizesort
- The sort- Returns:
- The pageable
-
from
@Internal @NonNull static @NonNull CursoredPageable from(int page, @Nullable @Nullable Pageable.Cursor cursor, Pageable.Mode mode, int size, @Nullable @Nullable Sort sort, boolean requestTotal) Creates a newCursoredPageable
with the given currentCursor.- Parameters:
page
- The pagecursor
- The current currentCursor that will be used for querying data.mode
- The pagination mode. Must be either forward or backward currentCursor pagination.size
- The page sizesort
- The sortrequestTotal
- Whether to request total count- Returns:
- The pageable
-
withoutSort
CursoredPageable withoutSort()Description copied from interface:Pageable
Removes ordering.- Specified by:
withoutSort
in interfacePageable
- Returns:
- A pageable without ordering
-
withoutPaging
CursoredPageable withoutPaging()Description copied from interface:Pageable
Removes paging.- Specified by:
withoutPaging
in interfacePageable
- Returns:
- A pageable without paging
-
withSort
Description copied from interface:Pageable
Creates a newPageable
with a custom sort. -
withTotal
CursoredPageable withTotal()Description copied from interface:Pageable
Specify that thePage
response should have information about total size. -
withoutTotal
CursoredPageable withoutTotal()Description copied from interface:Pageable
Specify that thePage
response should not have information about total size.- Specified by:
withoutTotal
in interfacePageable
- Returns:
- A pageable instance that won't request the total size.
- See Also:
-
orders
Description copied from interface:Sort
Adds an orders.
-