Interface PagingParams
-
- All Known Implementing Classes:
PagingRequest
public interface PagingParamsDefines the contract for query parameters for performing pagination and sorting.Note this allows standard pagination properties like page and limit, but also provides for two levels of sorting, a "primary" and a "secondary". For example, you might want to sort people's names by last name descending, then by first name ascending.
Note also that if there is only one sort, only the primary sort and direction should be set. If the primary sort is not defined, but the secondary sort is defined, then the behavior is up to the implementation. e.g. it may choose to ignore the secondary sort entirely, or it might treat the secondary sort as the primary one.
A page number and page size limit should always be specified. Sorting parameters are optional, but as mentioned above, the primary sort property and direction should be specified when only one level of sorting is required. Both primary and secondary sort can be specified when two levels are required.
- Implementation Note:
- Our specific needs have never required more than primary and second sorts, which is why there are only these two levels.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IntegergetLimit()IntegergetPage()org.springframework.data.domain.Sort.DirectiongetPrimaryDirection()StringgetPrimarySort()org.springframework.data.domain.Sort.DirectiongetSecondaryDirection()StringgetSecondarySort()voidsetLimit(Integer limit)voidsetPage(Integer page)voidsetPrimaryDirection(org.springframework.data.domain.Sort.Direction primaryDirection)voidsetPrimarySort(String primarySort)voidsetSecondaryDirection(org.springframework.data.domain.Sort.Direction secondaryDirection)voidsetSecondarySort(String secondarySort)
-
-
-
Method Detail
-
getPage
Integer getPage()
- Returns:
- the page number
-
setPage
void setPage(Integer page)
- Parameters:
page- the page number
-
getLimit
Integer getLimit()
- Returns:
- the page size limit
-
setLimit
void setLimit(Integer limit)
- Parameters:
limit- the page size limit
-
getPrimarySort
String getPrimarySort()
- Returns:
- the primary sort property
-
setPrimarySort
void setPrimarySort(String primarySort)
- Parameters:
primarySort- the primary sort property
-
getPrimaryDirection
org.springframework.data.domain.Sort.Direction getPrimaryDirection()
- Returns:
- the primary sort direction
-
setPrimaryDirection
void setPrimaryDirection(org.springframework.data.domain.Sort.Direction primaryDirection)
- Parameters:
primaryDirection- the primary sort direction
-
getSecondarySort
String getSecondarySort()
- Returns:
- the secondary sort property
-
setSecondarySort
void setSecondarySort(String secondarySort)
- Parameters:
secondarySort- the secondary sort property
-
getSecondaryDirection
org.springframework.data.domain.Sort.Direction getSecondaryDirection()
- Returns:
- the secondary sort direction
-
setSecondaryDirection
void setSecondaryDirection(org.springframework.data.domain.Sort.Direction secondaryDirection)
- Parameters:
secondaryDirection- the secondary sort direction
-
-