WeakMapInjectorRegistry

A InjectorRegistry implemented with a weak map. An entry from the map will be will be garbage collected once the Injector instance is no longer held elsewhere.

Note: the weak map will be cleared when app process is killed by system. Injectable implementations are responsible for detecting this and call Injectable.fallbackInitialize accordingly.

Properties

Link copied to clipboard

Global unique monotonically increasing key to be assigned as a suffixes to registered Injectors.

Link copied to clipboard

Cache to map Injector to its corresponding InjectorKey. Note: the Injector is the weak map key for itself to be garbage collected.

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
open override fun nextKey(prefix: String): String

Returns the next key to identify an Injector.

Link copied to clipboard
open override fun register(injector: Injector, key: String)

Registers an Injector instance with corresponding InjectorKey.

Link copied to clipboard
open override fun retrieve(injectorKey: String): Injector?

Retrieves an Injector instance from InjectorKey.