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

net.optionfactory.spring.marshaling.jaxb.time.XsdDateTimeToOffsetDateTime 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.OffsetDateTime;
import java.time.format.DateTimeFormatter;

public class XsdDateTimeToOffsetDateTime extends XmlAdapter {

    public static final DateTimeFormatter FORMAT = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy