I have a bean with a data type:
private java.time.Duration duration
the class attribute is set as follows:
object.setDuration(Duration.ofSeconds(2));
I want to arrange my object in xml so that the duration looks like
<duration>PT2S</duration>
as defined by ISO 8601
As far as I understand, Jaxb uses default binding data types , for example:
xsd:duration javax.xml.datatype.Duration
but in my bean I don't want to include any xml dependency.
I see the possibility of writing a wrapper where I can add an XmlAdapter , but I don't know how to convert java. time.Duration to javax.xml.datatype.Duration
source share