Did some cleanup

This commit is contained in:
Poslovitch 2017-06-02 23:28:29 +02:00
parent a419a66939
commit 9f0a05773e

View File

@ -20,9 +20,7 @@ import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.database.DatabaseConnecter; import us.tastybento.bskyblock.database.DatabaseConnecter;
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler; import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
/** /**
*
* Class that creates a list of <T>s filled with values from the corresponding * Class that creates a list of <T>s filled with values from the corresponding
* database-table. * database-table.
* *
@ -33,20 +31,17 @@ import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> { public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
private static final String DATABASE_FOLDER_NAME = "database"; private static final String DATABASE_FOLDER_NAME = "database";
public FlatFileDatabaseHandler(BSkyBlock plugin, Class<T> type, public FlatFileDatabaseHandler(BSkyBlock plugin, Class<T> type, DatabaseConnecter databaseConnecter) {
DatabaseConnecter databaseConnecter) {
super(plugin, type, databaseConnecter); super(plugin, type, databaseConnecter);
} }
@Override @Override
protected String createSelectQuery() { protected String createSelectQuery() {
// not used return ""; // not used
return "";
} }
@Override @Override
protected String createInsertQuery() { protected String createInsertQuery() {
// not used return ""; // not used
return "";
} }
/** /**
* Creates a <T> filled with values from the corresponding * Creates a <T> filled with values from the corresponding
@ -114,10 +109,7 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* @throws InvocationTargetException * @throws InvocationTargetException
*/ */
private T createObject(YamlConfiguration config) throws InstantiationException, IllegalAccessException, private T createObject(YamlConfiguration config) throws InstantiationException, IllegalAccessException, IntrospectionException, IllegalArgumentException, InvocationTargetException {
IntrospectionException, IllegalArgumentException, InvocationTargetException
{
T instance = type.newInstance(); T instance = type.newInstance();
for (Field field : type.getDeclaredFields()) { for (Field field : type.getDeclaredFields()) {
@ -239,5 +231,4 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
databaseConnecter.saveYamlFile(config, type.getSimpleName(), filename); databaseConnecter.saveYamlFile(config, type.getSimpleName(), filename);
} }
} }