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.ModeNested classes/interfaces inherited from interface io.micronaut.data.model.Sort
Sort.Order -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull CursoredPageablefrom(int page, @Nullable Pageable.Cursor cursor, Pageable.Mode mode, int size, @Nullable Sort sort, boolean requestTotal) Creates a newCursoredPageablewith the given currentCursor.static @NonNull CursoredPageableCreates a newCursoredPageablewith the given sort and page size.static @NonNull CursoredPageableCreates a newCursoredPageablewith the given sort.default Pageable.ModegetMode()The pagination mode that is either offset pagination, currentCursor forward or currentCursor backward pagination.booleanWhether the pageable is traversing backwards.orders(List<Sort.Order> orders) Adds an orders.Removes paging.Removes ordering.Specify that thePageresponse should not have information about total size.Creates a newPageablewith a custom sort.Specify that thePageresponse 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:PageableThe pagination mode that is either offset pagination, currentCursor forward or currentCursor backward pagination. -
from
Creates a newCursoredPageablewith the given sort.- Parameters:
sort- The sort- Returns:
- The pageable
-
from
Creates a newCursoredPageablewith 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 newCursoredPageablewith 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:PageableRemoves ordering.- Specified by:
withoutSortin interfacePageable- Returns:
- A pageable without ordering
-
withoutPaging
CursoredPageable withoutPaging()Description copied from interface:PageableRemoves paging.- Specified by:
withoutPagingin interfacePageable- Returns:
- A pageable without paging
-
withSort
Description copied from interface:PageableCreates a newPageablewith a custom sort. -
withTotal
CursoredPageable withTotal()Description copied from interface:PageableSpecify that thePageresponse should have information about total size. -
withoutTotal
CursoredPageable withoutTotal()Description copied from interface:PageableSpecify that thePageresponse should not have information about total size.- Specified by:
withoutTotalin interfacePageable- Returns:
- A pageable instance that won't request the total size.
- See Also:
-
orders
Description copied from interface:SortAdds an orders.
-