I know JAXB (Java Architecture for XML Binding) can marshal/unmarshal java.util.Date objects as seen in this answer by Blaise Doughan.
But what about the new java.time package objects in Java 8, such as ZonedDateTime? Has JAXB been updated to handle this newly built-in data type?
ZonedDateTime
In Java SE 8, JAXB has not been updated yet to support the java.time types.
Indeed, there is an issue related to this in the reference implementation.
You need to create and use an XmlAdapter to handle those types. Use an approach similar to that done with Joda-Time as described in this posting, JAXB and Joda-Time: Dates and Times.
XmlAdapter
You may be able to use this implementation of adapters for java.time.
1.4m articles
1.4m replys
5 comments
57.0k users