Interface PagingParams
- All Known Implementing Classes:
PagingRequest
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
Modifier and TypeMethodDescriptiongetLimit()getPage()org.springframework.data.domain.Sort.Directionorg.springframework.data.domain.Sort.Directiondefault booleanCheck if all pagination properties exist.default booleanCheck if there is a primary sort.default booleanCheck if there is a secondary sort.default booleanhasSort()Check if there is a primary or secondary sort.voidvoidsetNumbering(KiwiSearching.PageNumberingScheme numbering) voidvoidsetPrimaryDirection(org.springframework.data.domain.Sort.Direction primaryDirection) voidsetPrimarySort(String primarySort) voidsetSecondaryDirection(org.springframework.data.domain.Sort.Direction secondaryDirection) voidsetSecondarySort(String secondarySort)
-
Method Details
-
getPage
Integer getPage()- Returns:
- the page number
-
setPage
- Parameters:
page- the page number
-
getNumbering
KiwiSearching.PageNumberingScheme getNumbering()- Returns:
- the numbering scheme used by this instance
-
setNumbering
- Parameters:
numbering- the numbering scheme this instance should use
-
getLimit
Integer getLimit()- Returns:
- the page size limit
-
setLimit
- Parameters:
limit- the page size limit
-
hasPaginationProperties
default boolean hasPaginationProperties()Check if all pagination properties exist.- Returns:
- true if page, numbering scheme, and limit are all non-null, otherwise false
-
getPrimarySort
String getPrimarySort()- Returns:
- the primary sort property
-
setPrimarySort
- Parameters:
primarySort- the primary sort property
-
getPrimaryDirection
org.springframework.data.domain.Sort.Direction getPrimaryDirection()- Returns:
- the primary sort direction
- API Note:
- Implementations should return a non-null value if
hasPrimarySort()returns true
-
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
- Parameters:
secondarySort- the secondary sort property
-
getSecondaryDirection
org.springframework.data.domain.Sort.Direction getSecondaryDirection()- Returns:
- the secondary sort direction
- API Note:
- Implementations should return a non-null value if
hasSecondarySort()returns true
-
setSecondaryDirection
void setSecondaryDirection(org.springframework.data.domain.Sort.Direction secondaryDirection) - Parameters:
secondaryDirection- the secondary sort direction
-
hasSort
default boolean hasSort()Check if there is a primary or secondary sort.- Returns:
- true if there is a primary or secondary sort
-
hasPrimarySort
default boolean hasPrimarySort()Check if there is a primary sort.- Returns:
- true if
getPrimarySort()is not blank
-
hasSecondarySort
default boolean hasSecondarySort()Check if there is a secondary sort.- Returns:
- true if
getSecondarySort()is not blank
-