Last active
August 29, 2015 14:16
-
-
Save lukaspili/09a3a20a75f5a01936d0 to your computer and use it in GitHub Desktop.
D2 prez
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 characters
@Module | |
public class ApiModule { | |
private User user; | |
public ApiModule(User user) { | |
this.user = user; | |
} | |
@Provides | |
@Singleton | |
public Api providesApi() { | |
return new Api(user); | |
} | |
} | |
@Module | |
public class DatabaseModule { | |
@Provides | |
public Database providesDatabase() { | |
return new Database(); | |
} | |
} | |
@Component(modules = {ApiModule.class, DatabaseModule.class}) | |
@Singleton | |
public interface DataAccessComponent { | |
Api api(); | |
Database database(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment