Module bus.pager

Class Builder

java.lang.Object
org.miaixz.bus.pager.Builder

public class Builder extends Object
Utility class for common operations related to pagination, such as SQL parsing and instance creation.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • parse

      public static net.sf.jsqlparser.statement.Statement parse(String statementReader)
      Parses a SQL statement string into a Statement object.
      Parameters:
      statementReader - the SQL statement string to parse
      Returns:
      the parsed Statement object
      Throws:
      RuntimeException - if a JSQLParserException or ParseException occurs during parsing
    • newInstance

      public static <T> T newInstance(String classStr, Class<T> spi, Properties properties, Supplier<T> defaultSupplier)
      Creates a new instance of a class, supporting configuration and Service Provider Interface (SPI). The priority for instance creation is: configured class > SPI > default value.
      Type Parameters:
      T - the type of the instance to create
      Parameters:
      classStr - the fully qualified class name string, can be null or empty
      spi - the SPI interface class
      properties - the properties to set on the instance if it implements Property
      defaultSupplier - a supplier for the default instance if no other instance can be created
      Returns:
      a new instance of the specified type
    • newInstance

      public static <T> T newInstance(String classStr, Properties properties)
      Creates a new instance of a class from its fully qualified name.
      Type Parameters:
      T - the type of the instance to create
      Parameters:
      classStr - the fully qualified class name string
      properties - the properties to set on the instance if it implements Property
      Returns:
      a new instance of the specified type
      Throws:
      org.miaixz.bus.core.lang.exception.PageException - if an error occurs during instance creation
    • newInstance

      public static <T> T newInstance(Class<T> cls, Properties properties)
      Creates a new instance of a class from its Class object.
      Type Parameters:
      T - the type of the instance to create
      Parameters:
      cls - the Class object of the type to instantiate
      properties - the properties to set on the instance if it implements Property
      Returns:
      a new instance of the specified type
      Throws:
      org.miaixz.bus.core.lang.exception.PageException - if an error occurs during instance creation
    • current

      public static String current()
      Retrieves the current method stack trace information. This can be used to debug where a Page object was created.
      Returns:
      a string containing the current stack trace information