feat: add java.sql.Time converter support - #1092
SummerC0zyR0ck wants to merge 5 commits into
Conversation
9440e55 to
5dee8dc
Compare
|
Since the converter respects the configured For example, "HH:mm:ss a" produces "AM/PM" under |
Thanks for the suggestion! I added a locale-specific formatting test covering |
|
LGTM.
|
Thanks for the review and the LGTM! I understand the merge will wait until the current release is completed. I'll keep the branch rebased on main and am happy to resolve any conflicts if needed — just ping me when the release is done. |
02064d8 to
17da562
Compare
17da562 to
554769d
Compare
Purpose of the pull request
Related: #1017
Add first-class converter support for
java.sql.Time, following the existingLocalTimeconverter pattern.What's changed?
java.sql.Timerepresents a time-of-day value, but converter lookup uses the declared Java class. Therefore, the existingjava.util.DateandLocalTimeconverters do not apply to fields declared asjava.sql.Time.This PR adds a converter family under
org.apache.fesod.sheet.converters.sqltime:SqlTimeDateConverter- default write path using an ExcelDATEcell. It attachesDateUtils.EPOCH(1970-01-01) and appliesHH:mm:ssby default.SqlTimeNumberConverter- bidirectional Excel numeric serial conversion, includinguse1904windowing. Reading extracts the time component and discards any date component.SqlTimeStringConverter- bidirectionalSTRINGconversion. It defaults toHH:mm:ss, auto-detectsHH:mminput, and respects@DateTimeFormatand the configuredLocale.The converters reuse the existing
LocalTimeparsing, formatting, and Excel serial handling throughTime.toLocalTime()andTime.valueOf(LocalTime). No time-zone conversion is introduced.Registration in
DefaultConverterLoaderfollows theLocalTimepattern:initAllConverter()Tests
Tests cover converter keys, DATE/NUMBER/STRING conversion, custom date-time formats, 1904 date windowing, discarding the date component from numeric values, registry immutability, and round-trip behavior for XLSX, XLS, and CSV.
The complete
fesod-sheettest suite passes with 923 tests, and bothspotless:checkand Apache RAT checks are green.Scope is limited to
java.sql.Timeand remains JDK 8 compatible.