Created
April 25, 2017 11:43
-
-
Save tonyjs/ab668b4ca1a6c89eb903c960313ee229 to your computer and use it in GitHub Desktop.
Dagger2 Component
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
interface UserComponent { | |
// Not Working | |
val facebookRepository : UserRepository | |
val googleRepository : UserRepository | |
// Working | |
fun getFacebookRepository() : UserRepository | |
fun getGoogleRepository() : UserRepository | |
} | |
@Qualifier | |
@Retention(AnnotationRetention.RUNTIME) | |
annotation class Facebook | |
@Qualifier | |
@Retention(AnnotationRetention.RUNTIME) | |
annotation class Google |
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
interface UserReposiory { | |
fun getUser() | |
} | |
class FacebookRepository : UserRepository { | |
... | |
} | |
class GoogleRepository : UserRepository { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment