phax/ph-ubl

Use Java 8 date time classes

phax opened this issue · 5 comments

phax commented

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 commented

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

@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 commented

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

@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 commented

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.