I\'d like to create a registry for classes which are subclasses of a super class. The classes are stored in a map which acts as registry. A class is picked from the registry dep
clazz.getDeclaredConstructors()
to get all constructors of the class;There is no way for this to be entirely safe, since you can't know in advance whether any applicable public constructors exist for a given class, e.g. the ctor might be private, or the available constructors might not accept parameters of the type you want (e.g. needs a String, but you only have an Object).