- java.lang.Object
-
- io.rxmicro.config.Config
-
- io.rxmicro.data.sql.SQLDatabaseConfig
-
- Direct Known Subclasses:
SQLPooledDatabaseConfig
public class SQLDatabaseConfig extends io.rxmicro.config.ConfigAllows configuring SQL DB options.- Since:
- 0.1
- Author:
- nedis
- See Also:
Duration
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_HOSTDefault SQL database server host.
-
Constructor Summary
Constructors Constructor Description SQLDatabaseConfig()Creates an SQL config instance with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetConnectionString()Returns the connection string built from schema, host, port and database parameters.DurationgetConnectTimeout()Returns the connection timeout.StringgetDatabase()Returns the database name.StringgetHost()Returns the server host name.Optional<Map<String,String>>getOptions()Returns the db specific options.CharSequencegetPassword()Returns the database password.intgetPort()Returns the server port.StringgetUser()Returns the database username.SQLDatabaseConfigsetConnectTimeout(Duration connectTimeout)Sets the connection timeout.SQLDatabaseConfigsetDatabase(String database)Sets the database name.SQLDatabaseConfigsetHost(String host)Sets the server host name.SQLDatabaseConfigsetOptions(Map<String,String> options)Sets the additional database options.SQLDatabaseConfigsetPassword(CharSequence password)Sets the database password.SQLDatabaseConfigsetPort(int port)Sets the server port.SQLDatabaseConfigsetUser(String user)Sets the database username.protected voidvalidate(String namespace)
-
-
-
Field Detail
-
DEFAULT_HOST
public static final String DEFAULT_HOST
Default SQL database server host.- See Also:
- Constant Field Values
-
-
Method Detail
-
getHost
public String getHost()
Returns the server host name.- Returns:
- the server host name
-
setHost
@BuilderMethod public SQLDatabaseConfig setHost(String host)
Sets the server host name.- Parameters:
host- the server host name- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getPort
public int getPort()
Returns the server port.- Returns:
- the server port
-
setPort
@BuilderMethod public SQLDatabaseConfig setPort(int port)
Sets the server port.- Parameters:
port- the server port- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getUser
public String getUser()
Returns the database username.- Returns:
- the database username
-
setUser
@BuilderMethod public SQLDatabaseConfig setUser(String user)
Sets the database username.- Parameters:
user- the database username- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getPassword
public CharSequence getPassword()
Returns the database password.- Returns:
- the database password
-
setPassword
@BuilderMethod public SQLDatabaseConfig setPassword(CharSequence password)
Sets the database password.- Parameters:
password- the database password- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getDatabase
public String getDatabase()
Returns the database name.- Returns:
- the database name
-
setDatabase
@BuilderMethod public SQLDatabaseConfig setDatabase(String database)
Sets the database name.- Parameters:
database- the database name- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
setOptions
@BuilderMethod public SQLDatabaseConfig setOptions(Map<String,String> options)
Sets the additional database options.- Parameters:
options- the additional options- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getOptions
public Optional<Map<String,String>> getOptions()
Returns the db specific options.- Returns:
- the db specific options
-
getConnectTimeout
public Duration getConnectTimeout()
Returns the connection timeout.- Returns:
- the connection timeout
-
setConnectTimeout
@BuilderMethod public SQLDatabaseConfig setConnectTimeout(Duration connectTimeout)
Sets the connection timeout.- Parameters:
connectTimeout- the connection timeout- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getConnectionString
public String getConnectionString()
Returns the connection string built from schema, host, port and database parameters.- Returns:
- the connection string built from schema, host, port and database parameters
-
validate
protected void validate(String namespace)
- Overrides:
validatein classio.rxmicro.config.Config
-
-