當前位置: 首頁>>代碼示例>>Java>>正文


Java Currency.getCurrencyCode方法代碼示例

本文整理匯總了Java中java.util.Currency.getCurrencyCode方法的典型用法代碼示例。如果您正苦於以下問題:Java Currency.getCurrencyCode方法的具體用法?Java Currency.getCurrencyCode怎麽用?Java Currency.getCurrencyCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Currency的用法示例。


在下文中一共展示了Currency.getCurrencyCode方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPrice

import java.util.Currency; //導入方法依賴的package包/類
public static String getPrice(Currency currency, double value) {
    checkPropertiesAreLoaded();
    if (properties.containsKey(currency.getCurrencyCode())) {
        String[] currencyStrings = properties.getProperty(currency.getCurrencyCode()).split(DELIMETER);

        return getPriceFormatted(value,
                1,
                currencyBefore.contains(currency.getCurrencyCode()),
                Integer.valueOf(currencyStrings[FRACTIONS_NORMAL]),
                currencyStrings[CODE]);
    } else {
        return "not supported currency " + currency.getCurrencyCode();
    }
}
 
開發者ID:piskula,項目名稱:FuelUp,代碼行數:15,代碼來源:CurrencyUtil.java

示例2: getPricePerLitre

import java.util.Currency; //導入方法依賴的package包/類
public static String getPricePerLitre(Currency currency, double value) {
    checkPropertiesAreLoaded();
    if (properties.containsKey(currency.getCurrencyCode())) {
        String[] currencyStrings = properties.getProperty(currency.getCurrencyCode()).split(DELIMETER);

        int coefficientMultiply = Integer.valueOf(currencyStrings[COEFFICIENT_PER_LITRE_MULTIPLY]);
        return getPriceFormatted(value,
                coefficientMultiply,
                currencyBefore.contains(currency.getCurrencyCode()),
                Integer.valueOf(currencyStrings[FRACTIONS_PER_LITRE]),
                currencyStrings[coefficientMultiply == 1 ? CODE : CODE_PER_LITRE]);
    } else {
        return "not supported currency " + currency.getCurrencyCode();
    }
}
 
開發者ID:piskula,項目名稱:FuelUp,代碼行數:16,代碼來源:CurrencyUtil.java

示例3: unwrap

import java.util.Currency; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked" })
public <X> X unwrap(Currency value, Class<X> type, WrapperOptions options) {
	if ( value == null ) {
		return null;
	}
	if ( String.class.isAssignableFrom( type ) ) {
		return (X) value.getCurrencyCode();
	}
	throw unknownUnwrap( type );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:CurrencyTypeDescriptor.java

示例4: checkCountryCurrency

import java.util.Currency; //導入方法依賴的package包/類
static void checkCountryCurrency(String countryCode, String expected) {
    Locale locale = new Locale("", countryCode);
    Currency currency = Currency.getInstance(locale);
    String code = (currency != null) ? currency.getCurrencyCode() : null;
    if (!(expected == null ? code == null : expected.equals(code))) {
        throw new RuntimeException("Wrong currency for " +
                locale.getDisplayCountry() +
                ": expected " + expected + ", got " + code);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:CurrencyTest.java

示例5: testCountryCurrency

import java.util.Currency; //導入方法依賴的package包/類
private static void testCountryCurrency(String country, String currencyCode,
        int digits) {
    testCurrencyDefined(currencyCode, digits);
    Currency currency = Currency.getInstance(new Locale("", country));
    if (!currency.getCurrencyCode().equals(currencyCode)) {
        throw new RuntimeException("[" + country
                + "] expected: " + currencyCode
                + "; got: " + currency.getCurrencyCode());
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:Bug4512215.java

示例6: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
public void setCurrency(Currency currency) {
    this.currencyISOCode = currency.getCurrencyCode();
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:4,代碼來源:SupportedCurrencyData.java

示例7: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
public void setCurrency(Currency currency) {
    this.currency = currency.getCurrencyCode();
}
 
開發者ID:piskula,項目名稱:FuelUp,代碼行數:4,代碼來源:Vehicle.java

示例8: getAsText

import java.util.Currency; //導入方法依賴的package包/類
@Override
public String getAsText() {
	Currency value = (Currency) getValue();
	return (value != null ? value.getCurrencyCode() : "");
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:6,代碼來源:CurrencyEditor.java

示例9: toString

import java.util.Currency; //導入方法依賴的package包/類
@Override
public String toString(Currency value) {
	return value.getCurrencyCode();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:CurrencyTypeDescriptor.java

示例10: serialize

import java.util.Currency; //導入方法依賴的package包/類
@Override
public JsonElement serialize(Currency currency, Type type, JsonSerializationContext context) {
    return currency == null ? JsonNull.INSTANCE : new JsonPrimitive(currency.getCurrencyCode());
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:5,代碼來源:Json.java

示例11: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
/**
 * Sets the currency of these DecimalFormatSymbols.
 * This also sets the currency symbol attribute to the currency's symbol
 * in the DecimalFormatSymbols' locale, and the international currency
 * symbol attribute to the currency's ISO 4217 currency code.
 *
 * @param currency the new currency to be used
 * @exception NullPointerException if <code>currency</code> is null
 * @since 1.4
 * @see #setCurrencySymbol
 * @see #setInternationalCurrencySymbol
 */
public void setCurrency(Currency currency) {
    if (currency == null) {
        throw new NullPointerException();
    }
    this.currency = currency;
    intlCurrencySymbol = currency.getCurrencyCode();
    currencySymbol = currency.getSymbol(locale);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:DecimalFormatSymbols.java

示例12: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
/**
 * Sets the currency of these DecimalFormatSymbols.
 * This also sets the currency symbol attribute to the currency's symbol
 * in the DecimalFormatSymbols' locale, and the international currency
 * symbol attribute to the currency's ISO 4217 currency code.
 *
 * @param currency the new currency to be used
 * @exception NullPointerException if <code>currency</code> is null
 * @since 1.4
 * @see #setCurrencySymbol
 * @see #setInternationalCurrencySymbol
 */
public void setCurrency(Currency currency) {
    if (currency == null) {
        throw new NullPointerException();
    }
    initializeCurrency(locale);
    this.currency = currency;
    intlCurrencySymbol = currency.getCurrencyCode();
    currencySymbol = currency.getSymbol(locale);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:DecimalFormatSymbols.java


注:本文中的java.util.Currency.getCurrencyCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。