Skip to content

Instantly share code, notes, and snippets.

@tfcporciuncula
Last active March 13, 2023 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfcporciuncula/ebe98b52349ca938fcc14d70686f86a7 to your computer and use it in GitHub Desktop.
Save tfcporciuncula/ebe98b52349ca938fcc14d70686f86a7 to your computer and use it in GitHub Desktop.
@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