com.dft.api.shopify.model.adapters.CurrencyAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shopify-admin-rest Show documentation
Show all versions of shopify-admin-rest Show documentation
Shopify Admin REST API using JDK 11 and Reactive Programming
The newest version!
package com.dft.api.shopify.model.adapters;
import java.util.Currency;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.apache.commons.lang3.StringUtils;
public class CurrencyAdapter extends XmlAdapter {
@Override
public Currency unmarshal(final String currencyCode) throws Exception {
if (StringUtils.isBlank(currencyCode)) {
return null;
}
return Currency.getInstance(currencyCode);
}
@Override
public String marshal(final Currency currency) throws Exception {
if (currency == null) {
return null;
}
return currency.getCurrencyCode();
}
}