Class PagingRequest
- All Implemented Interfaces:
PagingParams
PagingParams.
Intended to be used in Jakarta REST resource classes with HTTP GET endpoint methods having an
argument annotated with BeanParam.
Example:
@GET
public Response page(@BeanParam PagingRequest pagingRequest) {
// ...
}
- Implementation Note:
- Requires Spring Data Commons and the Jakarta REST API to be available at runtime.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyOf()Create a copy of this instance.static PagingRequestcopyOf(PagingRequest original) Create a copy of the givenPagingRequest.static booleanensurePaginationProperties(PagingRequest request) Ensure the givenPagingRequesthas pagination properties by providing default values for any null or invalid properties.getLimit()The page size limit.The page numbering scheme used by this paging request.getPage()The page number.org.springframework.data.domain.Sort.DirectionThe primary sort direction.The primary sort property.org.springframework.data.domain.Sort.DirectionThe secondary sort direction.The secondary sort property.voidThe page size limit.voidsetNumbering(KiwiSearching.PageNumberingScheme numbering) The page numbering scheme used by this paging request.voidThe page number.voidsetPrimaryDirection(org.springframework.data.domain.Sort.Direction primaryDirection) The primary sort direction.voidsetPrimarySort(String primarySort) The primary sort property.voidsetSecondaryDirection(org.springframework.data.domain.Sort.Direction secondaryDirection) The secondary sort direction.voidsetSecondarySort(String secondarySort) The secondary sort property.toString()Ensure the givenPagingRequesthas pagination properties by providing default values for any null or invalid properties.static PagingRequestwithPaginationProperties(PagingRequest request) Ensure the givenPagingRequesthas pagination properties by providing default values for any null or invalid properties, returning the same instance if it is valid, and otherwise returning a new instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kiwiproject.spring.data.PagingParams
hasPaginationProperties, hasPrimarySort, hasSecondarySort, hasSort
-
Field Details
-
DEFAULT_MAX_LIMIT
public static final int DEFAULT_MAX_LIMIT- See Also:
-
-
Constructor Details
-
PagingRequest
public PagingRequest()
-
-
Method Details
-
copyOf
Create a copy of the givenPagingRequest.- Parameters:
original- the object to copy- Returns:
- a new instance containing the same values as
original - Throws:
IllegalArgumentException- iforiginalisnull
-
copyOf
Create a copy of this instance.- Returns:
- a new instance containing the same values as
this
-
ensurePaginationProperties
Ensure the givenPagingRequesthas pagination properties by providing default values for any null or invalid properties.Note specifically that this mutates the
requestargument in-place. You can use either the instance or staticwithPaginationPropertiesmethod to create a new instance with valid pagination properties to avoid mutation of the originalPagingRequestinstance.- Parameters:
request- thePagingRequestto check; this argument may be mutated in-place- Returns:
- true if
requestwas mutated, otherwise false
-
withPaginationProperties
Ensure the givenPagingRequesthas pagination properties by providing default values for any null or invalid properties, returning the same instance if it is valid, and otherwise returning a new instance.- Parameters:
request- the request to check- Returns:
requestif it contains pagination properties, otherwise a new instance with valid values for the missing properties
-
withPaginationProperties
Ensure the givenPagingRequesthas pagination properties by providing default values for any null or invalid properties.- Returns:
- this instance if it contains pagination properties, otherwise a new instance with valid values for the missing properties
-
getPage
The page number. Default is zero.Note this does not preclude using either zero or one-based page numbering, but other classes may require one or the other page numbering scheme.
- Specified by:
getPagein interfacePagingParams- Returns:
- the page number
-
getNumbering
The page numbering scheme used by this paging request.- Specified by:
getNumberingin interfacePagingParams- Returns:
- the numbering scheme used by this instance
-
getLimit
The page size limit. Default is 100.- Specified by:
getLimitin interfacePagingParams- Returns:
- the page size limit
-
getPrimarySort
The primary sort property. Default is null.- Specified by:
getPrimarySortin interfacePagingParams- Returns:
- the primary sort property
-
getPrimaryDirection
public org.springframework.data.domain.Sort.Direction getPrimaryDirection()The primary sort direction. Default is ascending (ASC).This is only relevant if a primarySort has been specified.
- Specified by:
getPrimaryDirectionin interfacePagingParams- Returns:
- the primary sort direction
-
getSecondarySort
The secondary sort property. Default is null.- Specified by:
getSecondarySortin interfacePagingParams- Returns:
- the secondary sort property
-
getSecondaryDirection
public org.springframework.data.domain.Sort.Direction getSecondaryDirection()The secondary sort direction. Default is ascending (ASC).This is only relevant if a secondarySort has been specified.
- Specified by:
getSecondaryDirectionin interfacePagingParams- Returns:
- the secondary sort direction
-
setPage
The page number. Default is zero.Note this does not preclude using either zero or one-based page numbering, but other classes may require one or the other page numbering scheme.
- Specified by:
setPagein interfacePagingParams- Parameters:
page- the page number
-
setNumbering
The page numbering scheme used by this paging request.- Specified by:
setNumberingin interfacePagingParams- Parameters:
numbering- the numbering scheme this instance should use
-
setLimit
The page size limit. Default is 100.- Specified by:
setLimitin interfacePagingParams- Parameters:
limit- the page size limit
-
setPrimarySort
The primary sort property. Default is null.- Specified by:
setPrimarySortin interfacePagingParams- Parameters:
primarySort- the primary sort property
-
setPrimaryDirection
public void setPrimaryDirection(org.springframework.data.domain.Sort.Direction primaryDirection) The primary sort direction. Default is ascending (ASC).This is only relevant if a primarySort has been specified.
- Specified by:
setPrimaryDirectionin interfacePagingParams- Parameters:
primaryDirection- the primary sort direction
-
setSecondarySort
The secondary sort property. Default is null.- Specified by:
setSecondarySortin interfacePagingParams- Parameters:
secondarySort- the secondary sort property
-
setSecondaryDirection
public void setSecondaryDirection(org.springframework.data.domain.Sort.Direction secondaryDirection) The secondary sort direction. Default is ascending (ASC).This is only relevant if a secondarySort has been specified.
- Specified by:
setSecondaryDirectionin interfacePagingParams- Parameters:
secondaryDirection- the secondary sort direction
-
toString
-