Add getShop to DAO, preparing to refactor shop loading
This commit is contained in:
@@ -7,21 +7,32 @@ import database.maker.MakerReagentRowMapper;
|
||||
import database.maker.MakerRecipeRowMapper;
|
||||
import database.note.NoteRowMapper;
|
||||
import database.shop.ShopItemRowMapper;
|
||||
import database.shop.ShopRowMapper;
|
||||
import org.jdbi.v3.core.Jdbi;
|
||||
import org.jdbi.v3.core.mapper.RowMapper;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
public final class JdbiConfig {
|
||||
private JdbiConfig() {}
|
||||
|
||||
public static Jdbi createConfigured(DataSource dataSource) {
|
||||
return Jdbi.create(dataSource)
|
||||
.registerRowMapper(new NoteRowMapper())
|
||||
.registerRowMapper(new MakerReagentRowMapper())
|
||||
.registerRowMapper(new MakerRecipeRowMapper())
|
||||
.registerRowMapper(new MakerIngredientRowMapper())
|
||||
.registerRowMapper(new MonsterDropRowMapper())
|
||||
.registerRowMapper(new GlobalMonsterDropRowMapper())
|
||||
.registerRowMapper(new ShopItemRowMapper());
|
||||
final Jdbi jdbi = Jdbi.create(dataSource);
|
||||
rowMappers().forEach(jdbi::registerRowMapper);
|
||||
return jdbi;
|
||||
}
|
||||
|
||||
private static List<RowMapper<?>> rowMappers() {
|
||||
return List.of(
|
||||
new NoteRowMapper(),
|
||||
new MakerReagentRowMapper(),
|
||||
new MakerRecipeRowMapper(),
|
||||
new MakerIngredientRowMapper(),
|
||||
new MonsterDropRowMapper(),
|
||||
new GlobalMonsterDropRowMapper(),
|
||||
new ShopRowMapper(),
|
||||
new ShopItemRowMapper()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user