Injectable

interface Injectable<FallbackInitializeParam>

Mark a class that can be injected by a Injector. This should be implemented by classes that cannot directly have their dependencies injected through constructor and need to have them injected through lateinit properties.

Functions

Link copied to clipboard
abstract fun fallbackInitialize(arg: FallbackInitializeParam)

Fallback initialization logic for the dependencies when Injector is not available. This could happen when the app process is killed and static Injectors are cleared up.

Extensions

Link copied to clipboard
fun <FallbackInitializeParam> Injectable<FallbackInitializeParam>.injectWithFallback(injectorKey: String?, fallbackInitializeParam: FallbackInitializeParam)

Try use an InjectorKey to retrieve an Injector and inject, if no Injector is found, invoke Injectable.fallbackInitialize with fallbackInitializeParam.