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
Post a Comment