Class PageRequest
java.lang.Object
com.blazebit.persistence.deltaspike.data.PageRequest
- All Implemented Interfaces:
Pageable,Serializable
- Direct Known Subclasses:
KeysetPageRequest
Immutable implementation of
Pageable, heavily inspired by Spring Data's PageRequest.- Since:
- 1.2.0
- Author:
- Christian Beikov
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPageRequest(int page, int pageSize) Creates a newPageRequestfor requesting the given page with the given page size.PageRequest(int page, int pageSize, Sort sort) Creates a newPageRequestwith given sorting.PageRequest(int page, int pageSize, Sort.Direction direction, String... paths) Creates a newPageRequestwith a sorting based on the given paths and direction.PageRequest(Sort sort, int offset, int pageSize) Creates a newPageRequestwith given sorting. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfirst()intReturns the offset represented by the page number multiplied with the page size.intReturns the page to be returned.intReturns the number of elements per page to be returned.getSort()Returns the sorting that should be used for pagination.inthashCode()booleanReturns whether there is a previous Pageable i.e. if the page number is greater than 0.next()previous()toString()
-
Constructor Details
-
PageRequest
public PageRequest(int page, int pageSize) Creates a newPageRequestfor requesting the given page with the given page size.- Parameters:
page- The zero based page numberpageSize- The number of elements per page
-
PageRequest
Creates a newPageRequestwith a sorting based on the given paths and direction.- Parameters:
page- The zero based page numberpageSize- The number of elements per pagedirection- The direction to use for theSortto be specified, may benullpaths- The paths to sort by
-
PageRequest
Creates a newPageRequestwith given sorting.- Parameters:
page- The zero based page numberpageSize- The number of elements per pagesort- The sorting to use for the page, may benull
-
PageRequest
Creates a newPageRequestwith given sorting.- Parameters:
sort- The sorting to use for the page, may benulloffset- The zero based offset numberpageSize- The number of elements per page- Since:
- 1.3.0
-
-
Method Details
-
getSort
Description copied from interface:PageableReturns the sorting that should be used for pagination. -
next
Description copied from interface:Pageable -
first
Description copied from interface:Pageable -
getPageSize
public int getPageSize()Description copied from interface:PageableReturns the number of elements per page to be returned.- Specified by:
getPageSizein interfacePageable- Returns:
- The number of elements per page
-
getPageNumber
public int getPageNumber()Description copied from interface:PageableReturns the page to be returned. Zero based.- Specified by:
getPageNumberin interfacePageable- Returns:
- The page to be returned.
-
getOffset
public int getOffset()Description copied from interface:PageableReturns the offset represented by the page number multiplied with the page size. -
hasPrevious
public boolean hasPrevious()Description copied from interface:PageableReturns whether there is a previous Pageable i.e. if the page number is greater than 0.- Specified by:
hasPreviousin interfacePageable- Returns:
- Whether there is a previous page
-
previous
Description copied from interface:Pageable -
previousOrFirst
Description copied from interface:PageableReturns the Pageable that can be used to request the previousPageor the first if the current one already is the first one.- Specified by:
previousOrFirstin interfacePageable- Returns:
- The Pageable for the previous or first Page
-
equals
-
hashCode
public int hashCode() -
toString
-