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

com.shopify.model.adapters.DateTimeAdapter Maven / Gradle / Ivy

There is a newer version: 2.9.3
Show newest version
package com.shopify.model.adapters;

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

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;

public class DateTimeAdapter extends XmlAdapter {

	@Override
	public DateTime unmarshal(final String timestamp) throws Exception {
		if (StringUtils.isBlank(timestamp)) {
			return null;
		}
		return DateTime.parse(timestamp);
	}

	@Override
	public String marshal(final DateTime dateTime) throws Exception {
		if (dateTime == null) {
			return null;
		}
		return dateTime.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy