Package toxi.util.datatypes
Class SingletonRegistry
java.lang.Object
toxi.util.datatypes.SingletonRegistry
Implements a registry for dynamic singleton management. Use this registry
instead of using "new" to enforce singletons of any class with a visible
default constructor. The registry itself is implemented as singleton.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SingletonRegistryThe singleton instance of the registry itself. -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectgetInstanceOf(String className) Creates or returns an instance of the class requested by name.static SingletonRegistryAlternative, more conventional accessor to the singleton instance of the registry itself.
-
Field Details
-
REGISTRY
The singleton instance of the registry itself.
-
-
Method Details
-
getInstanceOf
Creates or returns an instance of the class requested by name.- Parameters:
className-- Returns:
- class singleton instance
-
getRegistry
Alternative, more conventional accessor to the singleton instance of the registry itself.- Returns:
- registry instance
-