Package io.micronaut.data.model
Interface Pageable
-
- All Superinterfaces:
Sort
@Introspected public interface Pageable extends Sort
Models pageable data. Thefrom(int, int)method can be used to construct a new instance to pass to Micronaut Data methods.- Since:
- 1.0.0
- Author:
- boros, graemerocher
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.micronaut.data.model.Sort
Sort.Order
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Pageablefrom(int page)Creates a newPageableat the given offset with a default size of 10.static Pageablefrom(int page, int size)Creates a newPageableat the given offset.static Pageablefrom(int page, int size, Sort sort)Creates a newPageableat the given offset.static Pageablefrom(Sort sort)Creates a newPageableat the given offset.intgetNumber()default longgetOffset()Offset in the requested collection.default java.util.List<Sort.Order>getOrderBy()intgetSize()Maximum size of the page to be returned.default SortgetSort()default booleanisSorted()default booleanisUnpaged()default Pageablenext()default Pageableorder(Sort.Order order)Adds an order object.default Pageableorder(java.lang.String propertyName)Orders by the specified property name (defaults to ascending).default Pageableorder(java.lang.String propertyName, Sort.Order.Direction direction)Orders by the specified property name and direction.default Pageableprevious()static Pageableunpaged()
-
-
-
Field Detail
-
UNPAGED
static final Pageable UNPAGED
Constant for no pagination.
-
-
Method Detail
-
getNumber
int getNumber()
- Returns:
- The page number.
-
getSize
int getSize()
Maximum size of the page to be returned. A value of -1 indicates no maximum.- Returns:
- size of the requested page of items
-
getOffset
default long getOffset()
Offset in the requested collection. Defaults to zero.- Returns:
- offset in the requested collection
-
getSort
@NonNull default Sort getSort()
- Returns:
- The sort definition to use.
-
next
@NonNull default Pageable next()
- Returns:
- The next pageable.
-
previous
@NonNull default Pageable previous()
- Returns:
- The previous pageable
-
isUnpaged
default boolean isUnpaged()
- Returns:
- Is unpaged
-
order
@NonNull default Pageable order(@NonNull java.lang.String propertyName)
Description copied from interface:SortOrders by the specified property name (defaults to ascending).
-
isSorted
default boolean isSorted()
-
order
@NonNull default Pageable order(@NonNull Sort.Order order)
Description copied from interface:SortAdds an order object.
-
order
@NonNull default Pageable order(@NonNull java.lang.String propertyName, @NonNull Sort.Order.Direction direction)
Description copied from interface:SortOrders by the specified property name and direction.
-
getOrderBy
@NonNull default java.util.List<Sort.Order> getOrderBy()
- Specified by:
getOrderByin interfaceSort- Returns:
- The order definitions for this sort.
-
from
@NonNull static Pageable from(int page)
Creates a newPageableat the given offset with a default size of 10.- Parameters:
page- The page- Returns:
- The pageable
-
from
@NonNull static Pageable from(int page, int size)
Creates a newPageableat the given offset.- Parameters:
page- The pagesize- the size- Returns:
- The pageable
-
from
@NonNull static Pageable from(int page, int size, @Nullable Sort sort)
Creates a newPageableat the given offset.- Parameters:
page- The pagesize- the sizesort- the sort- Returns:
- The pageable
-
from
@NonNull static Pageable from(Sort sort)
Creates a newPageableat the given offset.- Parameters:
sort- the sort- Returns:
- The pageable
-
unpaged
@NonNull static Pageable unpaged()
- Returns:
- A new instance without paging data.
-
-