mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-18 23:27:43 +01:00
Renamed some of the database methods.
This commit is contained in:
parent
c1c00648d9
commit
c44e432aa3
@ -62,7 +62,7 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@Override
|
||||
public T selectObject(String key) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, ClassNotFoundException {
|
||||
public T loadObject(String key) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, ClassNotFoundException {
|
||||
YamlConfiguration config = databaseConnecter.loadYamlFile(type.getSimpleName(), key);
|
||||
return createObject(config);
|
||||
}
|
||||
@ -78,7 +78,7 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@Override
|
||||
public List<T> selectObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, ClassNotFoundException {
|
||||
public List<T> loadObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, ClassNotFoundException {
|
||||
List<T> list = new ArrayList<T>();
|
||||
FilenameFilter ymlFilter = new FilenameFilter() {
|
||||
@Override
|
||||
@ -201,7 +201,7 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void insertObject(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException {
|
||||
public void saveObject(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException {
|
||||
// This is the Yaml Configuration that will be used and saved at the end
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
// The file name of the Yaml file.
|
||||
|
@ -110,7 +110,7 @@ public abstract class AbstractDatabaseHandler<T> {
|
||||
* @throws SQLException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
protected abstract List<T> selectObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, SQLException, SecurityException, ClassNotFoundException;
|
||||
protected abstract List<T> loadObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, SQLException, SecurityException, ClassNotFoundException;
|
||||
|
||||
/**
|
||||
* Creates a <T> filled with values from the corresponding
|
||||
@ -126,10 +126,10 @@ public abstract class AbstractDatabaseHandler<T> {
|
||||
* @throws ClassNotFoundException
|
||||
* @throws SecurityException
|
||||
*/
|
||||
protected abstract T selectObject(String uniqueId) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, SQLException, SecurityException, ClassNotFoundException;
|
||||
protected abstract T loadObject(String uniqueId) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, SQLException, SecurityException, ClassNotFoundException;
|
||||
|
||||
/**
|
||||
* Inserts T into the corresponding database-table
|
||||
* Save T into the corresponding database
|
||||
*
|
||||
* @param instance that should be inserted into the database
|
||||
* @throws IllegalAccessException
|
||||
@ -141,6 +141,6 @@ public abstract class AbstractDatabaseHandler<T> {
|
||||
* @throws SQLException
|
||||
* @throws NoSuchMethodException
|
||||
*/
|
||||
protected abstract void insertObject(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, SQLException, SecurityException, InstantiationException, NoSuchMethodException;
|
||||
protected abstract void saveObject(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, SQLException, SecurityException, InstantiationException, NoSuchMethodException;
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class IslandsManager {
|
||||
islandsByUUID.clear();
|
||||
spawn = null;
|
||||
try {
|
||||
for (Object island : handler.selectObjects()) {
|
||||
for (Object island : handler.loadObjects()) {
|
||||
if (island instanceof Island) {
|
||||
islands.put(((Island)island).getCenter(), (Island)island);
|
||||
islandsByUUID.put(((Island)island).getOwner(), (Island)island);
|
||||
@ -76,7 +76,7 @@ public class IslandsManager {
|
||||
public void run() {
|
||||
for(Island island : islands.values()){
|
||||
try {
|
||||
handler.insertObject(island);
|
||||
handler.saveObject(island);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@ -87,7 +87,7 @@ public class IslandsManager {
|
||||
} else {
|
||||
for(Island island : islands.values()){
|
||||
try {
|
||||
handler.insertObject(island);
|
||||
handler.saveObject(island);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
@ -41,11 +41,11 @@ public class RunTest {
|
||||
BSBDatabase database = BSBDatabase.getDatabase();
|
||||
AbstractDatabaseHandler<Island> handler = (AbstractDatabaseHandler<Island>) database.getHandler(plugin, Island.class);
|
||||
|
||||
handler.insertObject(test);
|
||||
handler.saveObject(test);
|
||||
|
||||
plugin.getLogger().info("DEBUG: ALL WRITTEN! Now reading...");
|
||||
|
||||
test = handler.selectObject(test.getUniqueId());
|
||||
test = handler.loadObject(test.getUniqueId());
|
||||
|
||||
plugin.getLogger().info("DEBUG: name = " + test.getName());
|
||||
plugin.getLogger().info("DEBUG: owner = " + test.getOwner());
|
||||
|
@ -310,7 +310,7 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @see us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler#insertObject(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void insertObject(T instance) throws SQLException,
|
||||
public void saveObject(T instance) throws SQLException,
|
||||
SecurityException, IllegalArgumentException,
|
||||
InstantiationException, IllegalAccessException,
|
||||
IntrospectionException, InvocationTargetException, NoSuchMethodException {
|
||||
@ -484,7 +484,7 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@Override
|
||||
public List<T> selectObjects() throws SQLException,
|
||||
public List<T> loadObjects() throws SQLException,
|
||||
SecurityException, IllegalArgumentException,
|
||||
InstantiationException, IllegalAccessException,
|
||||
IntrospectionException, InvocationTargetException, ClassNotFoundException {
|
||||
@ -511,7 +511,7 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @see us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler#selectObject(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected T selectObject(String uniqueId) throws InstantiationException,
|
||||
protected T loadObject(String uniqueId) throws InstantiationException,
|
||||
IllegalAccessException, IllegalArgumentException,
|
||||
InvocationTargetException, IntrospectionException, SQLException, SecurityException, ClassNotFoundException {
|
||||
Connection connection = null;
|
||||
|
Loading…
Reference in New Issue
Block a user