Skip to content

feat: add java.sql.Time converter support - #1092

Open
SummerC0zyR0ck wants to merge 3 commits into
apache:mainfrom
SummerC0zyR0ck:feature-sql-time-converter
Open

feat: add java.sql.Time converter support#1092
SummerC0zyR0ck wants to merge 3 commits into
apache:mainfrom
SummerC0zyR0ck:feature-sql-time-converter

Conversation

@SummerC0zyR0ck

Copy link
Copy Markdown

Purpose of the pull request

Related: #1017

Add first-class converter support for java.sql.Time, following the existing LocalTime converter pattern.

What's changed?

java.sql.Time represents a time-of-day value, but converter lookup uses the declared Java class. Therefore, the existing java.util.Date and LocalTime converters do not apply to fields declared as java.sql.Time.

This PR adds a converter family under org.apache.fesod.sheet.converters.sqltime:

  • SqlTimeDateConverter - default write path using an Excel DATE cell. It attaches DateUtils.EPOCH (1970-01-01) and applies HH:mm:ss by default.
  • SqlTimeNumberConverter - bidirectional Excel numeric serial conversion, including use1904windowing. Reading extracts the time component and discards any date component.
  • SqlTimeStringConverter - bidirectional STRING conversion. It defaults to HH:mm:ss, auto-detects HH:mm input, and respects @DateTimeFormat and the configured Locale.

The converters reuse the existing LocalTime parsing, formatting, and Excel serial handling through Time.toLocalTime() and Time.valueOf(LocalTime). No time-zone conversion is introduced.

Registration in DefaultConverterLoader follows the LocalTime pattern:

  • Number and String converters in initAllConverter()
  • Date converter as the default write converter
  • String converter for string-formatted writes

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-sheet test suite passes with 923 tests, and both spotless:check and Apache RAT checks are green.

Scope is limited to java.sql.Time and remains JDK 8 compatible.

@SummerC0zyR0ck
SummerC0zyR0ck force-pushed the feature-sql-time-converter branch from 47ffb67 to 57b95ff Compare September 11, 2026 05:52
@SummerC0zyR0ck
SummerC0zyR0ck force-pushed the feature-sql-time-converter branch from 57b95ff to d07e5be Compare September 11, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant