Last active
May 13, 2020 19:03
-
-
Save Rasalexman/33b329413e9880cc0bfed2e20fd8188e to your computer and use it in GitHub Desktop.
BindSingle example
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
interface IAnotherClass | |
interface IMyClass : IAnotherClass | |
@BindSingle(toClass = IMyClass::class) | |
class MyClass( | |
private val anotherOne: IAnotherClass, | |
@IgonreInstance private val ignoredReference: String = "MyIgnoredReference" | |
) : IMyClass | |
// It is generate `Singleton` method for binding like: | |
val mainModule = KodiModule { | |
bind<IAnotherClass>() with single { MyClass(anotherOne = instance<IAnotherClass>()) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment