Class PageRequestImpl
- java.lang.Object
-
- de.digitalcollections.model.impl.paging.PageRequestImpl
-
- All Implemented Interfaces:
PageRequest,Serializable
- Direct Known Subclasses:
SearchPageRequestImpl
public class PageRequestImpl extends Object implements PageRequest, Serializable
Basic Java Bean implementation ofPageRequest. See Spring Data Commons, but more flat design and independent of Spring libraries.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.digitalcollections.model.api.paging.PageRequest
PageRequest.Builder
-
-
Constructor Summary
Constructors Constructor Description PageRequestImpl()PageRequestImpl(int pageNumber, int pageSize)Creates a newPageRequest.PageRequestImpl(int pageNumber, int pageSize, Direction direction, String... properties)Creates a newPageRequestwith sort parameters applied.PageRequestImpl(int pageNumber, int pageSize, Sorting sort)PageRequestImpl(int pageNumber, int pageSize, Sorting sort, Filtering filtering)Creates a newPageRequestwith sort parameters applied.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)PageRequestfirst()FilteringgetFiltering()intgetOffset()intgetPageNumber()intgetPageSize()SortinggetSorting()inthashCode()booleanhasPrevious()Returns whether there's a previousPageRequestwe can access from the current one.PageRequestnext()PageRequestprevious()Returns thePageResponserequesting the previous page.PageRequestpreviousOrFirst()voidsetFiltering(Filtering filtering)voidsetPageNumber(int pageNumber)voidsetPageSize(int pageSize)voidsetSorting(Sorting sort)StringtoString()
-
-
-
Constructor Detail
-
PageRequestImpl
public PageRequestImpl()
-
PageRequestImpl
public PageRequestImpl(int pageNumber, int pageSize)Creates a newPageRequest. Pages are zero indexed, thus providing 0 forpagewill return the first page.- Parameters:
pageNumber- zero-based page index.pageSize- the size of the page to be returned.
-
PageRequestImpl
public PageRequestImpl(int pageNumber, int pageSize, Direction direction, String... properties)Creates a newPageRequestwith sort parameters applied.- Parameters:
pageNumber- zero-based page index.pageSize- the size of the page to be returned.direction- the direction of theSortingImplto be specified, can be null.properties- the properties to sort by, must not be null or empty.
-
PageRequestImpl
public PageRequestImpl(int pageNumber, int pageSize, Sorting sort)
-
PageRequestImpl
public PageRequestImpl(int pageNumber, int pageSize, Sorting sort, Filtering filtering)Creates a newPageRequestwith sort parameters applied.- Parameters:
pageNumber- zero-based page index, must not be less than zero.pageSize- the size of the page to be returned, must not be less than one.sort- can be nullfiltering- contains list of filter criterias
-
-
Method Detail
-
first
public PageRequest first()
- Specified by:
firstin interfacePageRequest- Returns:
- the
PageRequestrequesting the first page
-
getFiltering
public Filtering getFiltering()
- Specified by:
getFilteringin interfacePageRequest- Returns:
- the filtering parameters
-
getOffset
public int getOffset()
- Specified by:
getOffsetin interfacePageRequest- Returns:
- the offset to be taken according to the underlying page and page size.
-
getPageNumber
public int getPageNumber()
- Specified by:
getPageNumberin interfacePageRequest- Returns:
- the page to be returned.
-
getPageSize
public int getPageSize()
- Specified by:
getPageSizein interfacePageRequest- Returns:
- the number of items of that page
-
getSorting
public Sorting getSorting()
- Specified by:
getSortingin interfacePageRequest- Returns:
- the sorting parameters
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:PageRequestReturns whether there's a previousPageRequestwe can access from the current one. Will return false in case the currentPageRequestalready refers to the first page.- Specified by:
hasPreviousin interfacePageRequest- Returns:
- whether there's a previous PageRequest
-
next
public PageRequest next()
- Specified by:
nextin interfacePageRequest- Returns:
- the
PageRequestrequesting the next page
-
previous
public PageRequest previous()
Returns thePageResponserequesting the previous page.- Returns:
- the PageResponse requesting the previous page
-
previousOrFirst
public PageRequest previousOrFirst()
- Specified by:
previousOrFirstin interfacePageRequest- Returns:
- the previous
PageRequestor the firstPageRequestif the current one already is the first one
-
setPageNumber
public void setPageNumber(int pageNumber)
- Specified by:
setPageNumberin interfacePageRequest- Parameters:
pageNumber- the page to be returned
-
setPageSize
public void setPageSize(int pageSize)
- Specified by:
setPageSizein interfacePageRequest- Parameters:
pageSize- the number of items of that page
-
setSorting
public void setSorting(Sorting sort)
- Specified by:
setSortingin interfacePageRequest- Parameters:
sort- the sorting parameters
-
setFiltering
public void setFiltering(Filtering filtering)
- Specified by:
setFilteringin interfacePageRequest- Parameters:
filtering- the filtering criterias
-
-