I am looking to create a specific type of Component based on a String in an XML-file.
This can be done with
clazzName = "NameComponent";
Class.forName("my.package.x.y.z." + clazzName).newInstance();
In the application I am looping through a list of clazzNames.
However, this gets pretty complicated once param-constructors come into play. Especially if everything is stored in XML files.
Is there a cleaner method without having to give the package information and without having to worry about constructor arguments?
I am open for suggestions on different technologies than XML, if that lets me use proper parameters and does not need package information of the class.
Aucun commentaire:
Enregistrer un commentaire