feat: add Character and Year converters (#1017) - #1087
Open
BigDataDZ wants to merge 5 commits into
Open
Conversation
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Author
|
Done in 254a11e — renamed to |
Contributor
|
It is recommended to add tests for the following scenarios to cover the complete behavior of
|
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Author
|
Added in faf2207, covering both layers:
Also adjusted the existing custom-format test: the previous Targeted tests 79/79, full fesod-sheet suite 933/933 green. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of the pull request
Implements two commonly used JDK 8 compatible converters requested by the community task #1017:
java.lang.Characterandjava.time.Year. Proposal comments:#1017 (comment) and the amendment below it
(
UUID/YearMonth/Instantwere proposed by other volunteers in parallel and are left tothem).
Related: #1017
What's changed?
CharacterStringConverter(org.apache.fesod.sheet.converters.charconverter): bidirectionalCharacter<-> STRING. Reading an empty string yieldsnull; strings longer than one characterthrow (wrapped into
ExcelDataConvertExceptionby the framework) instead of being silentlytruncated.
YearStringConverter(org.apache.fesod.sheet.converters.year): bidirectionalYear<->STRING, default format
uuuu, honors@DateTimeFormatcustom patterns andGlobalConfiguration.locale.Both follow the existing
*StringConverterpattern (e.g.LocalTimeStringConverter) and areregistered in
DefaultConverterLoaderunderputAllConverter,putWriteConverterandputWriteStringConverter, so they work on read, xlsx write and CSV write alike.Each converter ships with JUnit 5 unit tests (11 tests total: type keys, round-trips, default and
custom formats, and error cases).
Checklist