vendredi 27 mars 2020

Is it possible to create and instaciate an object using java reflect without class definition?

I want to create and instanciate an object which the type is not defined (no class definition) Class table = Class.forName(dbTable.getName()); Constructor<?> ctor = table.getConstructor(String.class); Object tableObject = ctor.newInstance(new Object[] {ListColumn}); here there is no a class definition named dbTable.getName() value. So i have a ClassNotFoundException.

Is there a method solving this kind of issues.





Aucun commentaire:

Enregistrer un commentaire