当前位置: 首页>>代码示例>>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;未经允许,请勿转载。