All Object getCellValue() does is change the location of the switch though 
right? User code still has to do it, either before the get, or after, and doing 
this with the setter vs. using overridden methods as we do right now seems to 
be a little anti-OO to me. I'm not real sure what annoying code would be 
avoided by using setCellValue(Object value), and the argument could be made 
that it is unnecessary code bloat as we already have setCellValue() for several 
object types. Maybe I don't understand what problem you are trying to solve.

-----Original Message-----
From: Greg Woolsey [mailto:greg.wool...@gmail.com] 
Sent: Friday, March 10, 2017 10:54 PM
To: POI Developers List <dev@poi.apache.org>
Subject: Re: Getting and setting cell value

I especially would like the setter, to avoid annoying code, and the getter 
would be nice in many cases where the value type doesn't matter or is better 
handled further downstream.

On Fri, Mar 10, 2017, 19:04 Javen O'Neal <one...@apache.org> wrote:

> Would it be a good idea to add the following two methods to the cell 
> interface so that the switch(cell.getCellType()) code can be taken 
> care of in POI?
>
> interface org.apache.poi.ss.usermodel.Cell {
>     Object getCellValue();
>     void setCellValue(Object value);
> }
>
> We would have to decide how to handle formulas, but otherwise the code 
> is straightforward. I think this would go a long way to making the POI 
> API easier to use.
>
> Any objections?
>

Reply via email to