All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.optionfactory.spring.marshaling.jaxb.time.XsdDateToLocalDate Maven / Gradle / Ivy

There is a newer version: 19.3
Show newest version
package net.optionfactory.spring.marshaling.jaxb.time;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class XsdDateToLocalDate extends XmlAdapter {

    public static final DateTimeFormatter FORMAT = DateTimeFormatter.ISO_DATE;

    @Override
    public LocalDate unmarshal(String value) {
        return value == null ? null : LocalDate.parse(value, FORMAT);
    }

    @Override
    public String marshal(LocalDate v) {
        return v == null ? null : FORMAT.format(v);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy