Class DataSourceContext
-
- All Implemented Interfaces:
public class DataSourceContextcurrent - current datasource backend - all backend datasource.- Since:
2019-05-24
trydofor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceDataSourceContext.Customizer
-
Field Summary
Fields Modifier and Type Field Description public DataSourcecurrent
-
Constructor Summary
Constructors Constructor Description DataSourceContext()
-
Method Summary
Modifier and Type Method Description DataSourcegetCurrent()DataSourceContextsetCurrent(DataSource current)DataSourceContextclearBackend()DataSourceContextaddBackend(String name, DataSource ds)DataSourceContextaddBackend(Map<String, DataSource> map)LinkedHashMap<String, DataSource>getBackends()Get all DataSource and its name StringbackendJdbcUrl(String name)Get the jdbc-url by the name of datasource StringcacheJdbcUrl(DataSource ds)Obtain the jdbc-url by the name of datasource, and cache it static StringextractUrl(DataSource ds)Extract the jdbc-url of the data source, not cached static ObjectknownJdbcUrl(@NotNull() DataSource ds)com.zaxxer.hikari.HikariConfig.getJdbcUrl() com.alibaba.druid.pool.DruidDataSource. StringtoString()-
-
Method Detail
-
getCurrent
DataSource getCurrent()
-
setCurrent
@Contract(value = "_->this") DataSourceContext setCurrent(DataSource current)
-
clearBackend
@Contract(value = "->this") DataSourceContext clearBackend()
-
addBackend
@Contract(value = "_,_->this") DataSourceContext addBackend(String name, DataSource ds)
-
addBackend
@Contract(value = "_->this") DataSourceContext addBackend(Map<String, DataSource> map)
-
getBackends
@NotNull() LinkedHashMap<String, DataSource> getBackends()
Get all DataSource and its name
-
backendJdbcUrl
@NotNull() String backendJdbcUrl(String name)
Get the jdbc-url by the name of datasource
-
cacheJdbcUrl
@NotNull() String cacheJdbcUrl(DataSource ds)
Obtain the jdbc-url by the name of datasource, and cache it
-
extractUrl
@NotNull() static String extractUrl(DataSource ds)
Extract the jdbc-url of the data source, not cached
-
knownJdbcUrl
static Object knownJdbcUrl(@NotNull() DataSource ds)
com.zaxxer.hikari.HikariConfig.getJdbcUrl() com.alibaba.druid.pool.DruidDataSource.getUrl()
- Returns:
String or null
-
-
-
-