java.lang.Object
org.miaixz.bus.pager.Builder
Utility class for common operations related to pagination, such as SQL parsing and instance creation.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringcurrent()Retrieves the current method stack trace information.static <T> TnewInstance(Class<T> cls, Properties properties) Creates a new instance of a class from itsClassobject.static <T> TnewInstance(String classStr, Class<T> spi, Properties properties, Supplier<T> defaultSupplier) Creates a new instance of a class, supporting configuration and Service Provider Interface (SPI).static <T> TnewInstance(String classStr, Properties properties) Creates a new instance of a class from its fully qualified name.static net.sf.jsqlparser.statement.StatementParses a SQL statement string into aStatementobject.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
parse
Parses a SQL statement string into aStatementobject.- Parameters:
statementReader- the SQL statement string to parse- Returns:
- the parsed Statement object
- Throws:
RuntimeException- if aJSQLParserExceptionorParseExceptionoccurs 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 emptyspi- the SPI interface classproperties- the properties to set on the instance if it implementsPropertydefaultSupplier- a supplier for the default instance if no other instance can be created- Returns:
- a new instance of the specified type
-
newInstance
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 stringproperties- the properties to set on the instance if it implementsProperty- Returns:
- a new instance of the specified type
- Throws:
org.miaixz.bus.core.lang.exception.PageException- if an error occurs during instance creation
-
newInstance
Creates a new instance of a class from itsClassobject.- Type Parameters:
T- the type of the instance to create- Parameters:
cls- theClassobject of the type to instantiateproperties- the properties to set on the instance if it implementsProperty- Returns:
- a new instance of the specified type
- Throws:
org.miaixz.bus.core.lang.exception.PageException- if an error occurs during instance creation
-
current
Retrieves the current method stack trace information. This can be used to debug where aPageobject was created.- Returns:
- a string containing the current stack trace information
-