Last active
March 13, 2023 17:26
-
-
Save tfcporciuncula/ebe98b52349ca938fcc14d70686f86a7 to your computer and use it in GitHub Desktop.
This file contains 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
@Qualifier annotation class SpecialGreeting1 | |
@Qualifier annotation class SpecialGreeting2 | |
@Module | |
@InstallIn(SingletonComponent::class) | |
object GreetingModule { | |
@Provides @SpecialGreeting1 | |
fun provideSpecialGreeting1(): String = "Heeeeey" | |
@Provides @SpecialGreeting2 | |
fun provideSpecialGreeting2(): String = "Oieeeee" | |
@Provides @IntoSet | |
fun provideEnglishGreeting(): String = "Hello" | |
@Provides @IntoSet | |
fun provideGermanGreeting(): String = "Hallo" | |
@Provides @IntoSet | |
fun providePortugueseGreeting(): String = "Olá" | |
@Module | |
@InstallIn(SingletonComponent::class) | |
interface Bindings { | |
// This is separate in its own module since it must be abstract | |
// and we can't have an abstract method in an object. | |
@Binds fun bind(impl: GreetingConcatenatorImpl): GreetingConcatenator | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment