Interface Pageable

All Superinterfaces:
Sort

@Introspected public interface Pageable extends Sort
Models pageable data. The from(int, int) method can be used to construct a new instance to pass to Micronaut Data methods.
Since:
1.0.0
Author:
boros, graemerocher
  • Field Details

    • UNPAGED

      static final Pageable UNPAGED
      Constant for no pagination.
  • Method Details

    • 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 @NonNull Sort getSort()
      Returns:
      The sort definition to use.
    • next

      @NonNull default @NonNull Pageable next()
      Returns:
      The next pageable.
    • previous

      @NonNull default @NonNull Pageable previous()
      Returns:
      The previous pageable
    • isUnpaged

      default boolean isUnpaged()
      Returns:
      Is unpaged
    • order

      @NonNull default @NonNull Pageable order(@NonNull @NonNull String propertyName)
      Description copied from interface: Sort
      Orders by the specified property name (defaults to ascending).
      Specified by:
      order in interface Sort
      Parameters:
      propertyName - The property name to order by
      Returns:
      A new sort with the order applied
    • isSorted

      default boolean isSorted()
      Specified by:
      isSorted in interface Sort
      Returns:
      Is sorting applied
    • order

      @NonNull default @NonNull Pageable order(@NonNull @NonNull Sort.Order order)
      Description copied from interface: Sort
      Adds an order object.
      Specified by:
      order in interface Sort
      Parameters:
      order - The order object
      Returns:
      A new sort with the order applied
    • order

      @NonNull default @NonNull Pageable order(@NonNull @NonNull String propertyName, @NonNull Sort.Order.Direction direction)
      Description copied from interface: Sort
      Orders by the specified property name and direction.
      Specified by:
      order in interface Sort
      Parameters:
      propertyName - The property name to order by
      direction - Either "asc" for ascending or "desc" for descending
      Returns:
      A new sort with the order applied
    • getOrderBy

      @NonNull default @NonNull List<Sort.Order> getOrderBy()
      Specified by:
      getOrderBy in interface Sort
      Returns:
      The order definitions for this sort.
    • from

      @NonNull static @NonNull Pageable from(int page)
      Creates a new Pageable at the given offset with a default size of 10.
      Parameters:
      page - The page
      Returns:
      The pageable
    • from

      @NonNull static @NonNull Pageable from(int page, int size)
      Creates a new Pageable at the given offset.
      Parameters:
      page - The page
      size - the size
      Returns:
      The pageable
    • from

      @NonNull static @NonNull Pageable from(int page, int size, @Nullable @Nullable Sort sort)
      Creates a new Pageable at the given offset.
      Parameters:
      page - The page
      size - the size
      sort - the sort
      Returns:
      The pageable
    • from

      @NonNull static @NonNull Pageable from(Sort sort)
      Creates a new Pageable at the given offset.
      Parameters:
      sort - the sort
      Returns:
      The pageable
    • unpaged

      @NonNull static @NonNull Pageable unpaged()
      Returns:
      A new instance without paging data.