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

pro.fessional.wings.silencer.jaxb.ZonedDateTimeXmlAdapter Maven / Gradle / Ivy

The newest version!
package pro.fessional.wings.silencer.jaxb;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author trydofor
 * @since 2021-04-19
 */
public class ZonedDateTimeXmlAdapter extends XmlAdapter {
    @Override
    public ZonedDateTime unmarshal(String stringValue) {
        return stringValue != null ? ZonedDateTime.parse(stringValue) : null;
    }

    @Override
    public String marshal(ZonedDateTime value) {
        return value != null ? value.format(DateTimeFormatter.ISO_ZONED_DATE_TIME) : null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy