java.lang.Object
org.miaixz.bus.pager.binding.PageParams
Configuration class for pagination parameters, responsible for managing and parsing pagination-related parameters.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe default column name for the count query.protected booleanWhether to useRowBounds.offsetas the page number.protected booleanIf true, andpageSizeis 0 (orRowBounds.limitis 0), all results are returned.protected booleanWhether to enable pagination reasonableness.protected booleanWhether to perform a count query when usingRowBounds.protected booleanWhether to support passing pagination parameters through method arguments. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the column name used for the count query.Retrieves thePageobject based on the provided query parameters andRowBounds.booleanChecks if asynchronous count queries are enabled.booleanChecks ifRowBounds.offsetis used as the page number.booleanChecks if all results are returned whenpageSizeis 0.booleanChecks if pagination reasonableness is enabled.booleanChecks if a count query is performed when usingRowBounds.booleanChecks if passing pagination parameters through method arguments is supported.voidsetProperties(Properties properties) Sets the pagination-related configuration properties.
-
Field Details
-
offsetAsPageNo
protected boolean offsetAsPageNoWhether to useRowBounds.offsetas the page number. Default is false. -
rowBoundsWithCount
protected boolean rowBoundsWithCountWhether to perform a count query when usingRowBounds. Default is false. -
pageSizeZero
protected boolean pageSizeZeroIf true, andpageSizeis 0 (orRowBounds.limitis 0), all results are returned. -
reasonable
protected boolean reasonableWhether to enable pagination reasonableness. Default is false. If enabled, page numbers will be adjusted to be within valid ranges. -
supportMethodsArguments
protected boolean supportMethodsArgumentsWhether to support passing pagination parameters through method arguments. Default is false. -
countColumn
The default column name for the count query. Defaults to "0".
-
-
Constructor Details
-
PageParams
public PageParams()
-
-
Method Details
-
getPage
Retrieves thePageobject based on the provided query parameters andRowBounds. It checks for existingPageinPageContext, or creates a new one fromrowBoundsorparameterObject.- Parameters:
parameterObject- the query parameter objectrowBounds- the MyBatis RowBounds object- Returns:
- a
Pageobject, or null if no pagination parameters are found
-
setProperties
Sets the pagination-related configuration properties. This method is typically called during plugin initialization to configure default behaviors.- Parameters:
properties- the configuration properties
-
isOffsetAsPageNo
public boolean isOffsetAsPageNo()Checks ifRowBounds.offsetis used as the page number.- Returns:
- true if offset is used as page number, false otherwise
-
isRowBoundsWithCount
public boolean isRowBoundsWithCount()Checks if a count query is performed when usingRowBounds.- Returns:
- true if count query is performed with RowBounds, false otherwise
-
isPageSizeZero
public boolean isPageSizeZero()Checks if all results are returned whenpageSizeis 0.- Returns:
- true if pageSize 0 returns all results, false otherwise
-
isReasonable
public boolean isReasonable()Checks if pagination reasonableness is enabled.- Returns:
- true if reasonableness is enabled, false otherwise
-
isSupportMethodsArguments
public boolean isSupportMethodsArguments()Checks if passing pagination parameters through method arguments is supported.- Returns:
- true if method arguments are supported for pagination, false otherwise
-
getCountColumn
Retrieves the column name used for the count query.- Returns:
- the count query column name
-
isAsyncCount
public boolean isAsyncCount()Checks if asynchronous count queries are enabled.- Returns:
- true if asynchronous count queries are enabled, false otherwise
-