Bug 65453

Summary: [PATCH] Add support for java boxed tyes Number & Boolean in setCellValue
Product: POI Reporter: Benjamin <benjamin>
Component: SS CommonAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: enhancement Keywords: PatchAvailable
Priority: P2    
Version: 5.0.x-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Represent null values of java's Number & Boolean as blank cells

Description Benjamin 2021-07-15 22:43:02 UTC
Created attachment 37958 [details]
Represent null values of java's Number & Boolean as blank cells

The current implementation for numeric values forces the usage of the raw type double. Usually java takes care of the type conversion from boxed types like Integer.

A special case occurs when the boxed type has the value null. I'm aware of the comment in #63242 that the developer should check for NPE, but this cuts short of what the intention of the value null might be.

I would like to argue, then when looking from the perspective of a data modeling the value null implies that there is no measurable value for something and a default value is wrong. 
Such value can be represented in Excel as an empty cell.

For implementation I choose to use a default method, since to sole purpose is to check for null values and in case of set the cell to be blank.
The Number supertype provides a way to unbox the values to a double while catching only the boxed types.