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

no.nav.sbl.dialogarena.adapters.DateAdapter Maven / Gradle / Ivy

package no.nav.sbl.dialogarena.adapters;

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

import org.joda.time.LocalDate;
import org.joda.time.format.ISODateTimeFormat;

public class DateAdapter extends XmlAdapter {

	public LocalDate unmarshal(String v) {
		if (v.contains("+")) {
			return new LocalDate(v.substring(0, v.indexOf('+')));
		}
		return new LocalDate(v);
	}

	public String marshal(LocalDate v) {
		return v != null ? v.toString(ISODateTimeFormat.date()) : null;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy