Module bus.pager

Class PageParams

java.lang.Object
org.miaixz.bus.pager.binding.PageParams

public class PageParams extends Object
Configuration class for pagination parameters, responsible for managing and parsing pagination-related parameters.
Since:
Java 17+
Author:
Kimi Liu
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    The default column name for the count query.
    protected boolean
    Whether to use RowBounds.offset as the page number.
    protected boolean
    If true, and pageSize is 0 (or RowBounds.limit is 0), all results are returned.
    protected boolean
    Whether to enable pagination reasonableness.
    protected boolean
    Whether to perform a count query when using RowBounds.
    protected boolean
    Whether to support passing pagination parameters through method arguments.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the column name used for the count query.
    getPage(Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    Retrieves the Page object based on the provided query parameters and RowBounds.
    boolean
    Checks if asynchronous count queries are enabled.
    boolean
    Checks if RowBounds.offset is used as the page number.
    boolean
    Checks if all results are returned when pageSize is 0.
    boolean
    Checks if pagination reasonableness is enabled.
    boolean
    Checks if a count query is performed when using RowBounds.
    boolean
    Checks if passing pagination parameters through method arguments is supported.
    void
    Sets the pagination-related configuration properties.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • offsetAsPageNo

      protected boolean offsetAsPageNo
      Whether to use RowBounds.offset as the page number. Default is false.
    • rowBoundsWithCount

      protected boolean rowBoundsWithCount
      Whether to perform a count query when using RowBounds. Default is false.
    • pageSizeZero

      protected boolean pageSizeZero
      If true, and pageSize is 0 (or RowBounds.limit is 0), all results are returned.
    • reasonable

      protected boolean reasonable
      Whether to enable pagination reasonableness. Default is false. If enabled, page numbers will be adjusted to be within valid ranges.
    • supportMethodsArguments

      protected boolean supportMethodsArguments
      Whether to support passing pagination parameters through method arguments. Default is false.
    • countColumn

      protected String countColumn
      The default column name for the count query. Defaults to "0".
  • Constructor Details

    • PageParams

      public PageParams()
  • Method Details

    • getPage

      public Page getPage(Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      Retrieves the Page object based on the provided query parameters and RowBounds. It checks for existing Page in PageContext, or creates a new one from rowBounds or parameterObject.
      Parameters:
      parameterObject - the query parameter object
      rowBounds - the MyBatis RowBounds object
      Returns:
      a Page object, or null if no pagination parameters are found
    • setProperties

      public void setProperties(Properties properties)
      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 if RowBounds.offset is 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 using RowBounds.
      Returns:
      true if count query is performed with RowBounds, false otherwise
    • isPageSizeZero

      public boolean isPageSizeZero()
      Checks if all results are returned when pageSize is 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

      public String 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