Created
May 2, 2020 10:10
-
-
Save aasitnikov/4a6c68b16f070641e132dbec05bbff90 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
class KotlinCircularComponent : CircularComponent { | |
private val apiServiceProvider = DelegateFactory<ApiService>() | |
private val authenticatorProvider = { Authenticator(createLazy(apiServiceProvider)) } | |
private val httpClientProvider = { HttpClient(authenticatorProvider()) } | |
init { | |
val delegate = createSingleton { ApiService(httpClientProvider()) } | |
DelegateFactory.setDelegate(apiServiceProvider, delegate) | |
} | |
override fun getApiService(): ApiService = apiServiceProvider() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment