How to call java reflection when you don't know the parameter type -


i want save parameter name, type , value in xml file , call , set object values through reflection. example:

<object type="objecttype">     <param name="param" type="integer" value="500"></param>     <param name="param2" type="bigdecimal" value="500"></param> </object>  class c = class.forname("objecttype"); object parsedobj = c.newinstance();  class paramclass = class.forname("java.math.bigdecimal"); method method = c.getdeclaredmethod(attribute.getparam(), new class[]{paramclass});  // here problem, not know how cast object correct object type.  method.invoke(parsedobj, new bigdecimal("500")); 

if know how parse object value "500" paramclass, please me answering thread.

thanks.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -