I have a json like
"Someform":"Somebuilder"
.I have parsed the json and retrieved value for Someform as below.
String formBuilder = pageJson.getString("Someform");
Now formBuilder contains "Someform" reference .
How do I get the class name for this i.e Someformclass . I used reflection like below
String className = formBuilder.getClass().getSimpleName();
Above statement is giving me String class name not the someform class name since formBuilder is String class. How do I get the someform class name which is dynamic so that I can pass this as argument to
Class builderName = Class.forName(className);
and invoke the method in that class.To be more precise I need to get the class name for Someform like SomeForm.class instead of String class.
Any help would be appreciated . TIA.
Aucun commentaire:
Enregistrer un commentaire