Skip to content
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

Add support to date parsing out-of-the-box #124

Merged
merged 8 commits into from
May 18, 2023
Merged

Conversation

oswaldobapvicjr
Copy link
Owner

@oswaldobapvicjr oswaldobapvicjr commented May 12, 2023

This adds support to convert string values into additional target types inside the ParseFactory:

  • java.sql.Date such as "2007-12-03"
  • java.sql.Timestamp such as "2007-12-03 10:15:30.998"
  • java.time.DayOfWeek such as "FRIDAY"
  • java.time.Duration such as "PT15M" (15 minutes)
  • java.time.Instant such as "2007-12-03T13:15:30Z"
  • java.time.LocalDate such as "2007-12-03"
  • java.time.LocalDateTime such as "2007-12-03T10:15:30"
  • java.time.Month such as "DECEMBER"
  • java.time.OffsetDateTime such as "2007-12-03T10:15:30-03:00"
  • java.time.ZonedDateTime such as "2007-12-03T10:15:30-03:00[America/Sao_Paulo]"
  • java.util.Date such as "2007-12-03T10:15:30+01:00" (accepting valid date-time representations in RFC 3339 formats)

So, the mappers PropertiesToObjectMapper<T> and INIToObjectMapper<T> can also produce beans containing fields from the abovementioned types.

@oswaldobapvicjr oswaldobapvicjr self-assigned this May 12, 2023
@oswaldobapvicjr oswaldobapvicjr added the enhancement New feature or request label May 12, 2023
@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Merging #124 (4fab0df) into master (976d2ae) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #124      +/-   ##
============================================
+ Coverage     99.22%   99.26%   +0.03%     
- Complexity      419      426       +7     
============================================
  Files            65       67       +2     
  Lines           773      811      +38     
  Branches         53       54       +1     
============================================
+ Hits            767      805      +38     
  Misses            5        5              
  Partials          1        1              
Impacted Files Coverage Δ
.../net/obvj/confectory/mapper/INIToObjectMapper.java 91.42% <100.00%> (ø)
...vj/confectory/mapper/PropertiesToObjectMapper.java 100.00% <100.00%> (ø)
.../main/java/net/obvj/confectory/util/DateUtils.java 100.00% <100.00%> (ø)
.../java/net/obvj/confectory/util/ParseException.java 100.00% <100.00%> (ø)
...in/java/net/obvj/confectory/util/ParseFactory.java 100.00% <100.00%> (ø)

@oswaldobapvicjr oswaldobapvicjr merged commit 154244c into master May 18, 2023
5 checks passed
@oswaldobapvicjr oswaldobapvicjr deleted the issue/0123 branch May 18, 2023 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant