Class PageRequestImpl
java.lang.Object
de.digitalcollections.model.impl.paging.PageRequestImpl
- All Implemented Interfaces:
PageRequest,java.io.Serializable
- Direct Known Subclasses:
SearchPageRequestImpl
public class PageRequestImpl extends java.lang.Object implements PageRequest, java.io.Serializable
Basic Java Bean implementation of
PageRequest. 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, java.lang.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
Modifier and Type Method Description booleanequals(java.lang.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)java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.digitalcollections.model.api.paging.PageRequest
add
-
Constructor Details
-
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, java.lang.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
-
PageRequestImpl
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 Details
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
first
- Specified by:
firstin interfacePageRequest- Returns:
- the
PageRequestrequesting the first page
-
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
- 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
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
next
- Specified by:
nextin interfacePageRequest- Returns:
- the
PageRequestrequesting the next page
-
previous
Returns thePageResponserequesting the previous page.- Returns:
- the PageResponse requesting the previous page
-
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
- Specified by:
setSortingin interfacePageRequest- Parameters:
sort- the sorting parameters
-
setFiltering
- Specified by:
setFilteringin interfacePageRequest- Parameters:
filtering- the filtering criterias
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-