reflection - Java Dynamic Casting in Apache POI -


i using apache poi yield excel reports, , since each column compatible respective datatype (date, number, integer ...), made static method return object can "casted".

since prone reducing code as possible, chose following:

string value = resultset.getstring(i);

object castablevalue = engine.formattingvalue(value);

cell.setcellvalue((castablevalue.getclass().cast(castablevalue)));

however, not accepted @ compile time poi library, while sure work @ run time.

i have use if else 4 datatypes (double, integer, calendar, , string).

any suggestions achieve dynamic solution ?


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -