I'm working on this program which takes input from user in form of "new id class arg0 arg1 …" (e.g. new obj1 String int:5 bool:true ...). After parsing this command, i need to create a new instance of the specified class and call its constructor with the "specified arguments". Now this is the part I've been stuck in, because all the examples i saw are like constructor.newInstance(String.class, bool.class) but in my case i'm getting the arguments in form of strings and i'm confused in how to convert them to that above form and call that specific constructor. Number of arguments are also not clear, so is there any easy solution to my problem? (making instance of the given class and calling constructor with the specified number of arguments) An example command and the action i need to perform is:
new x java.util.ArrayList int:5 --> x refers to “new ArrayList(5)”
ClassandConstructor.