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

io.inugami.commons.marshaling.jaxb.LocalDateAdapter Maven / Gradle / Ivy

There is a newer version: 3.3.5
Show newest version
package io.inugami.commons.marshaling.jaxb;


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

public class LocalDateAdapter extends XmlAdapter implements JaxbAdapterSpi {
    @Override
    public LocalDate unmarshal(final String value) throws Exception {
        return LocalDate.parse(value);
    }

    @Override
    public String marshal(final LocalDate value) throws Exception {
        return value == null ? null : value.format(DateTimeFormatter.ISO_DATE);
    }


    @Override
    public XmlAdapter getAdapter() {
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy