Switched tom JIT bindings for default implementations.

This commit is contained in:
neviyn 2016-03-18 17:12:48 +00:00
parent 95979fff29
commit 5e80829db0
4 changed files with 6 additions and 15 deletions

View File

@ -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);
}
}

View File

@ -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));

View File

@ -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 {
/**

View File

@ -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<Song> inputSong) throws StartPlayingException;
void stop();