jaxb - How to obtain the runtime type from an object in java -


i have code:

public void dosomething(integer param){ . . .   jaxbelement<integer> jaxb = new jaxbelement<integer>                                     (new qname("uri","local"),integer.class, param); . . . } 

and want more flexible. need parameter of type object, don't know how change line:

jaxbelement<what_do_i_put_here> jaxb = new jaxbelement<what_do_i_put_here>(new qname("uri","local"),integer.class, param);

i want use runtime class of type stored in param

public void dosomething(object param){ . . .   jaxbelement<??????> jaxb = new jaxbelement<??????>                                     (new qname("uri","local"),?????.class, param); . . . } 

not entirely sure (don't have access ide @ moment) isn't like

public <t extends object> void dosomething(t param) {     .     .     jaxbelement<t> jaxb = new jaxbelement<t>(new qname("uri", "local"), (class<t>) param.getclass(), param);     .     . } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -