-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locale-invariant parsing and formatting #343
Merged
Merged
Conversation
This file contains 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
Will be useful for representing the state of fractions of second internally.
Whether the month is formatted as a number or a name, and whether it's stored in `LocalDate` or `LocalDateTime`, we still say that this field represents a year. Each `FieldSpec` instance is a distinct such field.
We need a way to specify "format a month as a name" and "format a month as a number without padding." The new `FieldFormatDirective` interface encodes this concept.
`FormatStructure` defines how a thing is parsed and/or formatted. It encodes a group of `FieldFormatDirective` instances and directs how they should behave as a collective: * should they be parsed/output optionally? * can there be several alternatives during parsing? * etc. The intended way to use the format machinery is to specify a `FormatStructure` instance and obtain a parser or a formatter by calling `parser()` or `formatter()` on it. `CachedFormatStructure` can be used as a thin caching wrapper, ensuring `parser()` and `formatter()` don't get called repeatedly.
The new class is the superinterface of all the receivers exposed via the format builder DSL.
Also, provide means of parsing and formatting it.
ilya-g
approved these changes
Feb 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, all is clear
G.O.A.T. 🐐 |
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.
The same thing as #251 (except for small tidying up here and there), with the commit history rewritten to be more manageable. @ilya-g, does this commit history look ok?