Skip to content

Instantly share code, notes, and snippets.

@Rasalexman
Last active May 13, 2020 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rasalexman/33b329413e9880cc0bfed2e20fd8188e to your computer and use it in GitHub Desktop.
Save Rasalexman/33b329413e9880cc0bfed2e20fd8188e to your computer and use it in GitHub Desktop.
BindSingle example
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