Class SingletonEnforcer


  • public final class SingletonEnforcer
    extends Object
    Enforce singleton semantics: if an item already exists, an Error is thrown. Otherwise it is recorded for future checks. This facility exists because of ugly framework requirements for singletons to offer public constructors, which can allow more than one instance of a class to be instantiated.
    • Method Detail

      • get

        public static <T> T get​(Class<T> theClass)
      • register

        public static void register​(Class<?> theClass,
                                    Object theInstance)
      • deregister

        public static void deregister​(Class<?> theClass,
                                      Object theInstance)