Singleton is designed for the instance of that class. I think that the call against a .newInstance off the class loader would chain to the constructor, so a private or protected constructor will throw an exception.
To load, its a simple call to
. There is really no way to do this dynamically since you cannot stop an class with a public constructor from instantiating a new record. Any class to be a singleton has to be an instance of a Singleton first. You can call it against a dynamically loaded class though, that's just a simple try/catch and attempt to invoke the Method of getInstance on the class or cast to a Singleton type.
So if I got what you are looking for, your dynamically loaded classes implement singleton. You can load them as so:
Method getInstance = class.getClassLoader().loadClass("MyClass").getMethod("getInstance");
Object instance = getInstance.invoke();
catch (Exception ex)
Methinks that will work.