Class SQLManager.Builder
java.lang.Object
net.blockhost.commons.database.core.SQLManager.Builder
- Enclosing class:
SQLManager
Builder for creating SQLManager instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the SQLManager instance.config(PooledDatabaseConfig config) Sets all database settings from a pooled database configuration.infoLogger(Consumer<String> infoLogger) Sets a custom info log consumer.Sets the logger for database messages.Sets the connection pool name.warningLogger(Consumer<String> warningLogger) Sets a custom warning log consumer.
-
Method Details
-
config
Sets all database settings from a pooled database configuration.
This sets credentials, maxPoolSize, and minIdle from the config. Any previous values for these settings will be overwritten.
- Parameters:
config- the pooled database configuration- Returns:
- this builder
-
poolName
Sets the connection pool name.
This name will appear in thread names and JMX metrics.
- Parameters:
poolName- the pool name- Returns:
- this builder
-
logger
Sets the logger for database messages.- Parameters:
logger- the logger to use- Returns:
- this builder
-
infoLogger
Sets a custom info log consumer.
If set, this will be used instead of the logger for info messages.
- Parameters:
infoLogger- the info log consumer- Returns:
- this builder
-
warningLogger
Sets a custom warning log consumer.
If set, this will be used instead of the logger for warning messages.
- Parameters:
warningLogger- the warning log consumer- Returns:
- this builder
-
build
Builds the SQLManager instance.- Returns:
- a new SQLManager
- Throws:
NullPointerException- if credentials is not set
-