From 5e80829db0cc021736ada003c8d9b751dd40da2a Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Fri, 18 Mar 2016 17:12:48 +0000 Subject: [PATCH] Switched tom JIT bindings for default implementations. --- src/main/java/musicplayer/BindingsModule.java | 14 -------------- src/main/java/musicplayer/PlayerGUI.java | 2 +- .../callbacks/PlayerCallbackInterface.java | 3 +++ src/main/java/musicplayer/player/IPlayer.java | 2 ++ 4 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 src/main/java/musicplayer/BindingsModule.java diff --git a/src/main/java/musicplayer/BindingsModule.java b/src/main/java/musicplayer/BindingsModule.java deleted file mode 100644 index b9a4f48..0000000 --- a/src/main/java/musicplayer/BindingsModule.java +++ /dev/null @@ -1,14 +0,0 @@ -package musicplayer; - -import com.google.inject.AbstractModule; -import musicplayer.callbacks.PlayerCallbackInterface; -import musicplayer.player.IPlayer; -import musicplayer.player.GStreamerPlayer; - -public class BindingsModule extends AbstractModule { - @Override - protected void configure() { - bind(IPlayer.class).to(GStreamerPlayer.class); - bind(PlayerCallbackInterface.class).to(PlayerGUI.class); - } -} diff --git a/src/main/java/musicplayer/PlayerGUI.java b/src/main/java/musicplayer/PlayerGUI.java index 839102f..a9dda10 100644 --- a/src/main/java/musicplayer/PlayerGUI.java +++ b/src/main/java/musicplayer/PlayerGUI.java @@ -103,7 +103,7 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf public static void main(String[] args) { DatabaseManager.init(); - Injector injector = Guice.createInjector(new BindingsModule()); + Injector injector = Guice.createInjector(); PlayerGUI playerGUI = injector.getInstance(PlayerGUI.class); JFrame frame = new JFrame(); frame.setMinimumSize(new Dimension(600, 400)); diff --git a/src/main/java/musicplayer/callbacks/PlayerCallbackInterface.java b/src/main/java/musicplayer/callbacks/PlayerCallbackInterface.java index f829a06..63a830b 100644 --- a/src/main/java/musicplayer/callbacks/PlayerCallbackInterface.java +++ b/src/main/java/musicplayer/callbacks/PlayerCallbackInterface.java @@ -1,7 +1,10 @@ package musicplayer.callbacks; +import com.google.inject.ImplementedBy; +import musicplayer.PlayerGUI; import musicplayer.model.Song; +@ImplementedBy(PlayerGUI.class) public interface PlayerCallbackInterface { /** diff --git a/src/main/java/musicplayer/player/IPlayer.java b/src/main/java/musicplayer/player/IPlayer.java index 063a430..8a934b2 100644 --- a/src/main/java/musicplayer/player/IPlayer.java +++ b/src/main/java/musicplayer/player/IPlayer.java @@ -1,10 +1,12 @@ package musicplayer.player; +import com.google.inject.ImplementedBy; import musicplayer.StartPlayingException; import musicplayer.model.Song; import java.util.Optional; +@ImplementedBy(GStreamerPlayer.class) public interface IPlayer { void playSong(Optional inputSong) throws StartPlayingException; void stop();