com.shopify.model.adapters.DateTimeAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shopify-sdk Show documentation
Show all versions of shopify-sdk Show documentation
Java SDK for Shopify REST API.
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