Skip to content

Instantly share code, notes, and snippets.

@klukwist
Created October 13, 2022 15:57
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 klukwist/271d01917835d5aa8cae86ac435b996d to your computer and use it in GitHub Desktop.
Save klukwist/271d01917835d5aa8cae86ac435b996d to your computer and use it in GitHub Desktop.
object SimpleDiScope {
inline fun <reified T : Any> factory(factory: InstanceType.Factory<T>) {
SimpleDiStorage.addFactory(factory)
}
inline fun <reified T : Any> factoryWithParams(factory: InstanceType.ParamFactory<T>) {
SimpleDiStorage.addFactory(factory)
}
inline fun <reified T : Any> singleton(factory: InstanceType.Factory<T>) {
SimpleDiStorage.addFactory(InstanceType.Singleton<T>(factory))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment