Created
May 23, 2020 06:16
-
-
Save Zhuinden/3ea36a728d2933e63808b6296a658e62 to your computer and use it in GitHub Desktop.
AssistedInjection sample #1 - without 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( | |
private val a: A, | |
private val b: B, | |
private val c: C, | |
private val runtimeArg: RuntimeArg | |
) { | |
class Factory @Inject constructor( | |
private val a: A, | |
private val b: B, | |
private val c: C | |
) { | |
fun create(runtimeArg: RuntimeArg) = D(a, b, c, runtimeArg) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment