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

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

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

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

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

* String format details: *

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy