Re: In a String I've got the type of a class, in another one the value. I want to create an instance of the class with the value...
Posted By:
Colin_Dunn
Posted On:
Tuesday, November 19, 2002 12:54 AM
Try this, should be easy to adapt to your code:
Class myClass=Class.forName(returnType.getName());
Class[] paramClassArray=new Class[]{String.class};
Constructor constructor=myClass.getConstructor(paramClassArray);
Object object=constructor.newInstance(new Object[]{"22102002"});