Module bus.pager

Class Serialize<T>

java.lang.Object
org.miaixz.bus.pager.Serialize<T>
Type Parameters:
T - the type of elements in the paginated data
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Paginating

public class Serialize<T> extends Object implements Serializable
Paging information class used to store the result set and total number of records for a paginated query. This class supports serialization.
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<T>
    The paginated result set.
    protected long
    The total number of records.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for Serialize.
    Serialize(List<? extends T> list)
    Constructs a Serialize object based on a given list of results.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the paginated result set.
    long
    Retrieves the total number of records.
    static <T> Serialize<T>
    of(List<? extends T> list)
    Static factory method to create a Serialize object.
    void
    setList(List<T> list)
    Sets the paginated result set.
    void
    setTotal(long total)
    Sets the total number of records.
    Returns a string representation of the Serialize object.

    Methods inherited from class java.lang.Object

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

    • total

      protected long total
      The total number of records.
    • list

      protected List<T> list
      The paginated result set.
  • Constructor Details

    • Serialize

      public Serialize()
      Default constructor for Serialize.
    • Serialize

      public Serialize(List<? extends T> list)
      Constructs a Serialize object based on a given list of results. If the list is an instance of Page, the total will be retrieved from it; otherwise, the total will be the size of the list.
      Parameters:
      list - the list of paginated results
  • Method Details

    • of

      public static <T> Serialize<T> of(List<? extends T> list)
      Static factory method to create a Serialize object.
      Type Parameters:
      T - the type of elements in the paginated data
      Parameters:
      list - the list of paginated results
      Returns:
      a new Serialize object
    • getTotal

      public long getTotal()
      Retrieves the total number of records.
      Returns:
      the total number of records
    • setTotal

      public void setTotal(long total)
      Sets the total number of records.
      Parameters:
      total - the total number of records to set
    • getList

      public List<T> getList()
      Retrieves the paginated result set.
      Returns:
      the list of paginated results
    • setList

      public void setList(List<T> list)
      Sets the paginated result set.
      Parameters:
      list - the list of paginated results to set
    • toString

      public String toString()
      Returns a string representation of the Serialize object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object