-
-
Save lol768/0e20dae19378decd65cb to your computer and use it in GitHub Desktop.
Revisions
-
lol768 revised this gist
Jan 11, 2015 . 5 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes. -
natemort revised this gist
Jan 11, 2015 . 3 changed files with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ public interface DatabaseManager { public void doStuff(); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ @Database(DatabaseType.MYSQL) @PluginService public class MysqlDatabaseManager implements DatabaseManager { public void doStuff() { System.out.println("Doing stuff in mysql"); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ @Database(DatabaseType.SQLITE) @PluginService public class SqliteDatabaseManager implements DatabaseManager { public void doStuff() { System.out.println("Doing stuff in sqlite"); } } -
natemort created this gist
Jan 11, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ public @interface Database { public DatabaseType value(); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ public enum DatabaseType { SQLITE, MYSQL, ; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ public class Plugin extends JavaPlugin { public void onEnable() { BukkitGuice guice = new BukkitGuice(this); // In a real application you'd read the DatabaseType from the config and compare the value to that. guice.addConstraint(Database.class, database -> database.value() == DatabaseType.SQLITE); guice.start(); } }