Description
see https://stackoverflow.com/questions/36156741/marshalling-localdate-using-jaxb
sample code:
// DOMAIN CODE @XmlRootElement(name = "Demo") @XmlType @XmlAccessorType(XmlAccessType.FIELD) @DomainObject(nature=Nature.VIEW_MODEL, editing=Editing.ENABLED) @Log public class TemporalDemo extends DemoStub { @PostConstruct public void initDefaults() { log.info("TemporalDemo::initDefaults"); javaLocalDate = LocalDate.now(); javaLocalDateTime = LocalDateTime.now(); } @XmlJavaTypeAdapter(value = LocalDateAdapter.class) @XmlElement @Getter @Setter private LocalDate javaLocalDate; @XmlJavaTypeAdapter(value = LocalDateTimeAdapter.class) @XmlElement @Getter @Setter private LocalDateTime javaLocalDateTime; } // COULD BE PART OF CORE public final class JaxbAdapters { public static final class LocalDateAdapter extends XmlAdapter<String, LocalDate>{ public LocalDate unmarshal(String v) throws Exception { return LocalDate.parse(v); } public String marshal(LocalDate v) throws Exception { return v.toString(); } } public static final class LocalDateTimeAdapter extends XmlAdapter<String, LocalDateTime>{ public LocalDateTime unmarshal(String v) throws Exception { return LocalDateTime.parse(v); } public String marshal(LocalDateTime v) throws Exception { return v.toString(); } } ... }