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

com.dft.api.shopify.model.adapters.CurrencyAdapter Maven / Gradle / Ivy

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();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy