Created
May 23, 2020 06:17
-
-
Save Zhuinden/8143630b73d9c7f553580b57b7ae425c to your computer and use it in GitHub Desktop.
AssistedInjection sample #2 - with assisted injection
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
class RuntimeArg {} | |
@Singleton class A @Inject constructor() | |
@Singleton class B @Inject constructor(private val a: A) | |
@Singleton class C @Inject constructor(private val b: B) | |
class D @AssistedInject constructor( | |
private val a: A, | |
private val b: B, | |
private val c: C, | |
@Assisted private val runtimeArg: RuntimeArg | |
) { | |
@AssistedInject.Factory | |
interface Factory { | |
fun create(runtimeArg: RuntimeArg): D | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment