Class SingletonRegistry

java.lang.Object
toxi.util.datatypes.SingletonRegistry

public class SingletonRegistry extends Object
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 Details

    • REGISTRY

      public static final SingletonRegistry REGISTRY
      The singleton instance of the registry itself.
  • Method Details

    • getInstanceOf

      public static Object getInstanceOf(String className)
      Creates or returns an instance of the class requested by name.
      Parameters:
      className -
      Returns:
      class singleton instance
    • getRegistry

      public static SingletonRegistry getRegistry()
      Alternative, more conventional accessor to the singleton instance of the registry itself.
      Returns:
      registry instance