first commit
This commit is contained in:
20
src/main/java/com/andrewkydev/database/DatabaseProvider.java
Normal file
20
src/main/java/com/andrewkydev/database/DatabaseProvider.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.andrewkydev.database;
|
||||
|
||||
public final class DatabaseProvider {
|
||||
private static volatile DatabaseApi api;
|
||||
|
||||
private DatabaseProvider() {
|
||||
}
|
||||
|
||||
public static void set(DatabaseApi api) {
|
||||
DatabaseProvider.api = api;
|
||||
}
|
||||
|
||||
public static DatabaseApi get() {
|
||||
DatabaseApi current = api;
|
||||
if (current == null) {
|
||||
throw new IllegalStateException("DatabaseApi is not initialized");
|
||||
}
|
||||
return current;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user