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

Use Java 8 date time classes #27

Closed
phax opened this issue Jul 11, 2020 · 5 comments
Closed

Use Java 8 date time classes #27

phax opened this issue Jul 11, 2020 · 5 comments
Assignees

Comments

@phax
Copy link
Owner

phax commented Jul 11, 2020

Use the following global bindings:

<xjc:javaType name="java.time.LocalDateTime" xmlType="xs:dateTime" adapter="..." />
<xjc:javaType name="java.time.LocalTime" xmlType="xs:time" adapter="..." />
<xjc:javaType name="java.time.LocalDate" xmlType="xs:date" adapter="..." />
<xjc:javaType name="java.time.Duration" xmlType="xs:duration" adapter="..." />
@phax phax self-assigned this Jul 11, 2020
phax added a commit that referenced this issue Aug 28, 2020
phax added a commit that referenced this issue Aug 28, 2020
phax added a commit that referenced this issue Aug 28, 2020
@phax
Copy link
Owner Author

phax commented Aug 28, 2020

Part of 6.4.0 release. Only Date, Time and DateTime are used.

@phax phax closed this as completed Aug 28, 2020
@Penait1
Copy link

Penait1 commented May 3, 2021

@phax Hey, quick question. Does this mean there is no timezone support anymore? Since only the ZonedDateTime supports a timezone, and the LocalDatime/Time/Date classes not.

@phax
Copy link
Owner Author

phax commented May 3, 2021

Hi @Penait1 there was quite some stuggle on my side with all these time zones ;-)

  • So in 6.4.0 I changed to Local(Date|Time|DateTime) - until somebody reminded me, that they don't support timezones..
  • So in 6.5.0 I changed to Offset(Date|Time|DateTime) - until somebody reminded me, that we don't always want timezones.
  • And in 6.6.0 I changed to XMLOffset(Date|Time|DateTime) - these are my own compositions very similar to Offset(Date|Time|DateTime) but with an optional ZoneOffset - so you can use with or without time zone, and you have different Java types for different XSD types

hth

@Penait1
Copy link

Penait1 commented May 3, 2021

@phax Thank you for your quick reply! We were planning to migrate to your new version (think we tried 6.4.0 then) a few weeks ago but that was one of the hurdles. Apparently we were not the only ones and it's already fixed, great to hear

@phax
Copy link
Owner Author

phax commented May 3, 2021

Yes, it was an "unfortunate" history, but I am pretty confident that, this solution is now sustainable. Ping me (ideally with a new issue) if you have troubles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants