JAXB adapters for Java 8 Date and Time API (JSR-310) types
Java
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE.txt
README.md
pom.xml

README.md

JAXB adapters for Java 8 Date and Time API (JSR-310) types

Build Status

New Date and Time API introduced in Java 8 (aka JSR-310) is a big step forward comparing to what were available before in the JVM standard library. Sad thing that Java Architecture for XML Binding (JAXB) by default do not speak the new types. This library aimes to address the issue by providing a collection of type adapters to enable use of Java 8 Date and Time API types in JAXB bindings.

In serialization/deserialization logic the library follows the ISO 8601 standard formats wherever applicable.

Provided adapters:

  • TemporalAccessorXmlAdapter - base class for an XML adapter mapping a TemporalAccessor's subclass to String using given DateTimeFormatter

    Example:

    public class DottedDateXmlAdapter extends TemporalAccessorXmlAdapter<LocalDate> {
        public DottedDateXmlAdapter() {
            super(DateTimeFormatter.ofPattern("dd.MM.yyyy"), LocalDate::from);
        }
    }
  • DurationXmlAdapter

  • InstantXmlAdapter

  • LocalDateTimeXmlAdapter

  • LocalDateXmlAdapter

  • LocalTimeXmlAdapter

  • OffsetDateTimeXmlAdapter

  • OffsetTimeXmlAdapter

  • PeriodXmlAdapter

  • ZonedDateTimeXmlAdapter

  • MonthDayXmlAdapter

  • YearMonthXmlAdapter

  • YearXmlAdapter

  • ZoneIdXmlAdapter - for JSR-310's ZoneId and ZoneOffset

Source code is licensed under Apache 2.0 licence.

Releases

Release 1.1.3 is the current latest release. It depends on JDK 1.8 or later.

Available in the Maven Central repository

Support

Please use GitHub issues and Pull Requests for support.