Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

@IntoMap capabilities #7

Open
afollestad opened this issue Aug 2, 2019 · 0 comments
Open

@IntoMap capabilities #7

afollestad opened this issue Aug 2, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@afollestad
Copy link
Owner

A simple case:

@Module
abstract class MyModule1 {
  @Provides @IntoMap("one") 
  fun stringOne(): String = "hello, "
}

@Module
abstract class MyModule2 {
  @Provides @IntoMap("two")
  fun stringTwo(): String = "world!"
}

...

@Inject lateinit var strings: Map<String, String> // ["one": "hello, ", "two": "world!"]

A qualified case:

@Module
abstract class MyModule1 {
  @Provides @IntoMap("test", "one") 
  fun stringOne(): String = "hello, "
}

@Module
abstract class MyModule2 {
  @Provides @IntoMap("test", "two") 
  fun stringTwo(): String = "world!"
}

...

@Inject("test") lateinit var strings: Map<String, String> // ["one": "hello, ", "two": "world!"]
@afollestad afollestad added the enhancement New feature or request label Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant