Package io.quarkus.panache.common
Class Page
- java.lang.Object
-
- io.quarkus.panache.common.Page
-
public class Page extends Object
Utility class to represent paging information. Page instances are immutable.
Usage:
Page page = Page.ofSize(25); Page secondPage = page.next();
- Author:
- Stéphane Épardaud
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Pagefirst()Returns a new page with the first page index (0) and the same size, or this page if it is the first page.Pageindex(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.Pagenext()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.Pageprevious()Returns a new page with the previous page index and the same size, or this page if it is the first page.
-
-
-
Constructor Detail
-
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:
ofSize(int)
-
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:
of(int, int)
-
-
Method Detail
-
of
public static Page of(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
-
ofSize
public static Page ofSize(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
-
next
public Page 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()
-
previous
public Page 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:
next()
-
first
public Page 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
public 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.- 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.
-
-