Class DurationXmlAdapter


  • public class DurationXmlAdapter
    extends jakarta.xml.bind.annotation.adapters.XmlAdapter<String,​Duration>
    • Constructor Detail

      • DurationXmlAdapter

        public DurationXmlAdapter()
    • Method Detail

      • unmarshal

        public Duration unmarshal​(String stringValue)
        Specified by:
        unmarshal in class jakarta.xml.bind.annotation.adapters.XmlAdapter<String,​Duration>
      • marshal

        public String marshal​(Duration duration)
        XML datatype xs:duration is only partially based on ISO-8601, and differs when it comes to negative durations. While ISO-8601 allows for negative values for each part of the duration (e.g. PT-1M-30S), an xs:duration only allows the entire duration to be negative - i.e. -PT1M30S This method rewrites the produced Duration-string to produce a valid xs:duration
        Specified by:
        marshal in class jakarta.xml.bind.annotation.adapters.XmlAdapter<String,​Duration>
        Parameters:
        duration -
        Returns: