Package io.quarkus.panache.common
Class Page
java.lang.Object
io.quarkus.panache.common.Page
Utility class to represent paging information. Page instances are immutable.
Usage:
Page page = Page.ofSize(25);
Page secondPage = page.next();
- Author:
- Stéphane Épardaud
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfirst()Returns a new page with the first page index (0) and the same size, or this page if it is the first page.index(int newIndex) Returns a new page at the given page index and the same size, or this page if the page index is the same.next()Returns a new page with the next page index and the same size.static Pageof(int index, int size) Builds a page of the given index and size.static PageofSize(int size) Builds a page of the given size.previous()Returns a new page with the previous page index and the same size, or this page if it is the first page.
-
Field Details
-
index
public final int indexThe current page index (0-based). -
size
public final int sizeThe current page size;
-
-
Constructor Details
-
Page
public Page(int size) Builds a page of the given size.- Parameters:
size- the page size- Throws:
IllegalArgumentException- if the page size is less than or equal to 0- See Also:
-
Page
public Page(int index, int size) Builds a page of the given index and size.- Parameters:
index- the page index (0-based)size- the page size- Throws:
IllegalArgumentException- if the page index is less than 0IllegalArgumentException- if the page size is less than or equal to 0- See Also:
-
-
Method Details
-
of
Builds a page of the given index and size.- Parameters:
index- the page index (0-based)size- the page size- Throws:
IllegalArgumentException- if the page index is less than 0IllegalArgumentException- if the page size is less than or equal to 0
-
ofSize
Builds a page of the given size.- Parameters:
size- the page size- Throws:
IllegalArgumentException- if the page size is less than or equal to 0
-
next
Returns a new page with the next page index and the same size.- Returns:
- a new page with the next page index and the same size.
- See Also:
-
previous
Returns a new page with the previous page index and the same size, or this page if it is the first page.- Returns:
- a new page with the next page index and the same size, or this page if it is the first page.
- See Also:
-
first
Returns a new page with the first page index (0) and the same size, or this page if it is the first page.- Returns:
- a new page with the first page index (0) and the same size, or this page if it is the first page.
-
index
Returns a new page at the given page index and the same size, or this page if the page index is the same.- Parameters:
newIndex- the new page index- Returns:
- a new page at the given page index and the same size, or this page if the page index is the same.
-