Reputation: 12898
Im trying to add data to a excel sheet with Apache POI but at compile time i dont know what type the actual data objects are which im trying to add to the sheet.
Is there some nice way to just do someThing like
Object obj= someObject;
cell.setValue(obj);
without doing the boilerplate of if/else and instanceof calls to determine whether obj is boolean, date, string, or numeric.
If the object is neither of these types i would expect Obj.toString(); to end up in the cell.
Upvotes: 0
Views: 556
Reputation: 23629
Instead of boilerplate if/else, can't you just overload your method parameters so that you have one method call for each case.
Upvotes: 1