Bug 65453 - [PATCH] Add support for java boxed tyes Number & Boolean in setCellValue
Summary: [PATCH] Add support for java boxed tyes Number & Boolean in setCellValue
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 5.0.x-dev
Hardware: All All
: P2 enhancement with 2 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-15 22:43 UTC by Benjamin
Modified: 2021-07-15 22:43 UTC (History)
0 users



Attachments
Represent null values of java's Number & Boolean as blank cells (4.61 KB, patch)
2021-07-15 22:43 UTC, Benjamin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.