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

com.migesok.jaxb.adapter.javatime.DurationXmlAdapter Maven / Gradle / Ivy

The newest version!
package com.migesok.jaxb.adapter.javatime;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.time.Duration;

/**
 * {@code XmlAdapter} mapping JSR-310 {@code Duration} to ISO-8601 string
 * 

* String format details: *

    *
  • {@link java.time.Duration#parse(java.lang.CharSequence)}
  • *
  • {@link java.time.Duration#toString()}
  • *
* * @see javax.xml.bind.annotation.adapters.XmlAdapter * @see java.time.Duration */ public class DurationXmlAdapter extends XmlAdapter { @Override public Duration unmarshal(String stringValue) { return stringValue != null ? Duration.parse(stringValue) : null; } @Override public String marshal(Duration value) { return value != null ? value.toString() : null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy