StaticclearRemoves every stored instance — useful for test teardown.
StaticgetRetrieves the instance stored under name.
The caller specifies the expected type via the generic parameter; no runtime type-check is performed.
Expected type of the stored instance.
Identifier of the instance to retrieve.
(Exception) - name is not registered.
StatichasChecks whether an instance is stored under name.
Identifier to look up.
StaticregisterStores instance under the given name.
Each name can only be registered once. Call unregister first if you need to replace an existing instance.
The type of the instance being stored.
Unique identifier for this instance.
The object to store.
(Exception) - name is already taken.
StaticunregisterRemoves the instance stored under name.
After this call, name can be registered again with a new instance.
Identifier of the instance to remove.
(Exception) - name is not registered.
Global, type-safe store for named instances.
Register an instance once at startup, then retrieve it anywhere by name without passing references around.
Example