@Test public void builder() throws SQLException { DBTemplate db1 = new Builder("ds1").dataSource(new HikariDataSource()) .config(config -> config.setDbType(DbType.SQL_SERVER)) .mapping(mapper -> { mapper.register(String.class, new StringPropertyHandler()); }).build(); DBTemplate db2 = new Builder("ds2").dataSource(new HikariDataSource()) .config(config -> config.setDbType(DbType.MYSQL)) .mapping(mapper -> { mapper.register(String.class, new StringPropertyHandler()); }).build(); Assert.assertEquals(DbType.SQL_SERVER, db1.getDbConfig().getDbType()); Assert.assertEquals(DbType.MYSQL, db2.getDbConfig().getDbType()); }
public DBConfig getDbConfig() { return dbConfig; }
DBTemplate { public DBConfig getDbConfig() { return dbConfig; } }
DBTemplate { public DBConfig getDbConfig() { return dbConfig; } private  DBTemplate(Builder builder); }
DBTemplate { public DBConfig getDbConfig() { return dbConfig; } private  DBTemplate(Builder builder); static DBTemplate get(String dsName); String getDsName(); DataSource getDataSource(); ConnFactory getConnectionFactory(); DBConfig getDbConfig(); SqlLog getSqlLog(); PKGenerator getPkGenerator(); }
DBTemplate { public DBConfig getDbConfig() { return dbConfig; } private  DBTemplate(Builder builder); static DBTemplate get(String dsName); String getDsName(); DataSource getDataSource(); ConnFactory getConnectionFactory(); DBConfig getDbConfig(); SqlLog getSqlLog(); PKGenerator getPkGenerator();  }