java.util.Currency#getCurrencyCode ( )源码实例Demo

下面列出了java.util.Currency#getCurrencyCode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u-dev-jdk   文件: Bug4512215.java

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());
    }
}
 
源代码2 项目: scipio-erp   文件: UtilHttp.java

/**
 * Get the currency string from the session.
 * @param session HttpSession object to use for lookup
 * @return String The ISO currency code
 */
public static String getCurrencyUom(HttpSession session, String appDefaultCurrencyUom) {
    // session, should override all if set there
    String iso = (String) session.getAttribute("currencyUom");

    // check userLogin next, ie if nothing to override in the session
    if (iso == null) {
        Map<String, ?> userLogin = UtilGenerics.cast(session.getAttribute("userLogin"));
        if (userLogin == null) {
            userLogin = UtilGenerics.cast(session.getAttribute("autoUserLogin"));
        }

        if (userLogin != null) {
            iso = (String) userLogin.get("lastCurrencyUom");
        }
    }

    // no user currency? before global default try appDefaultCurrencyUom if specified
    if (iso == null && UtilValidate.isNotEmpty(appDefaultCurrencyUom)) {
        iso = appDefaultCurrencyUom;
    }

    // if none is set we will use the configured default
    if (iso == null) {
        try {
            iso = UtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD");
        } catch (Exception e) {
            Debug.logWarning("Error getting the general:currency.uom.id.default value: " + e.toString(), module);
        }
    }


    // if still none we will use the default for whatever currency we can get...
    if (iso == null) {
        Currency cur = Currency.getInstance(getLocale(session));
        iso = cur.getCurrencyCode();
    }

    return iso;
}
 
源代码3 项目: jdk8u_jdk   文件: Bug4512215.java

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());
    }
}
 
源代码4 项目: openjdk-8-source   文件: CurrencyTest.java

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);
    }
}
 
源代码5 项目: native-obfuscator   文件: CurrencyTest.java

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);
    }
}
 
源代码6 项目: native-obfuscator   文件: Bug4512215.java

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());
    }
}
 
源代码7 项目: hottub   文件: Bug4512215.java

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

@Override
public String toNonNullValue(Currency value) {
    return value.getCurrencyCode();
}
 
源代码9 项目: blog_demos   文件: CurrencyEditor.java

@Override
public String getAsText() {
	Currency value = (Currency) getValue();
	return (value != null ? value.getCurrencyCode() : "");
}
 

@Override
public String convert(Currency source) {
	return source.getCurrencyCode();
}
 

@Override
public String getAsText() {
	Currency value = (Currency) getValue();
	return (value != null ? value.getCurrencyCode() : "");
}
 
源代码12 项目: lams   文件: CurrencyTypeDescriptor.java

@Override
public String toString(Currency value) {
	return value.getCurrencyCode();
}
 

/**
 * 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);
}
 

/**
 * 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);
}
 

/**
 * 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);
}
 
源代码16 项目: jdk8u_jdk   文件: DecimalFormatSymbols.java

/**
 * 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);
}
 
源代码17 项目: jdk8u60   文件: DecimalFormatSymbols.java

/**
 * 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);
}
 
源代码18 项目: jdk8u-jdk   文件: DecimalFormatSymbols.java

/**
 * 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);
}
 

/**
 * 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);
}
 
源代码20 项目: j2objc   文件: DecimalFormatSymbols.java

/**
 * 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);
    //cachedIcuDFS = null;
}