Package java.util

Examples of java.util.Currency


    QuercusLocale money = env.getLocaleInfo().getMonetary();

    Locale locale = money.getLocale();

    DecimalFormatSymbols decimal = new DecimalFormatSymbols(locale);
    Currency currency = NumberFormat.getInstance(locale).getCurrency();

    array.put(env.createString("decimal_point"),
              env.createString(decimal.getDecimalSeparator()));
    array.put(env.createString("thousands_sep"),
              env.createString(decimal.getGroupingSeparator()));
    //array.put("grouping", "");
    array.put(env.createString("int_curr_symbol"),
              env.createString(decimal.getInternationalCurrencySymbol()));
    array.put(env.createString("currency_symbol"),
              env.createString(decimal.getCurrencySymbol()));
    array.put(env.createString("mon_decimal_point"),
              env.createString(decimal.getMonetaryDecimalSeparator()));
    array.put(env.createString("mon_thousands_sep"),
              env.createString(decimal.getGroupingSeparator()));
    //array.put("mon_grouping", "");
    array.put(env.createString("positive_sign"), env.getEmptyString());
    array.put(env.createString("negative_sign"),
              env.createString(decimal.getMinusSign()));
    array.put(env.createString("int_frac_digits"),
              LongValue.create(currency.getDefaultFractionDigits()));
    array.put(env.createString("frac_digits"),
              LongValue.create(currency.getDefaultFractionDigits()));
    //array.put("p_cs_precedes", "");
    //array.put("p_sep_by_space", "");
    //array.put("n_cs_precedes", "");
    //array.put("n_sep_by_space", "");
    //array.put("p_sign_posn", "");
View Full Code Here


     * locale, or null
     */
    public static Currency getCurrency(final Locale locale) {
        try {
            final DecimalFormatSymbols dfs = getDecimalFormatSymbols(locale);
            final Currency currency = dfs.getCurrency();
            return currency;
        } catch (Throwable t) {
        }
        return null;
    }
View Full Code Here

     * @param locale
     * @return
     */
    public static String getCurrencyAsString(final Locale locale) {
        final Locale loc = LocaleUtils.getCountry(locale);
        final Currency currency = Currency.getInstance(loc);
        final String symbol = currency.getSymbol();
        final String code = currency.getCurrencyCode();
        if (StringUtils.hasText(symbol)
                && !symbol.equalsIgnoreCase(code)) {
            return symbol + "(" + code + ")";
        } else {
            return code;
View Full Code Here

        return LocaleUtils.getCurrencySymbol(locale);
    }

    public static String getCurrencySymbol(final Locale locale) {
        final Locale loc = LocaleUtils.getCountry(locale);
        final Currency currency = Currency.getInstance(loc);
        return currency.getSymbol();
    }
View Full Code Here

        final Currency currency = Currency.getInstance(loc);
        return currency.getSymbol();
    }

    public static String getCurrencySymbol(final String currencyCode) {
        final Currency currency = Currency.getInstance(currencyCode);
        return currency.getSymbol();
    }
View Full Code Here

        return LocaleUtils.getCurrencyCode(locale);
    }

    public static String getCurrencyCode(final Locale locale) {
        final Locale loc = LocaleUtils.getCountry(locale);
        final Currency currency = Currency.getInstance(loc);
        return currency.getCurrencyCode();
    }
View Full Code Here

        return LocaleUtils.getCurrencyDisplayName(locale);
    }

    public static String getCurrencyDisplayName(final Locale locale) {
        final Locale loc = LocaleUtils.getCountry(locale);
        final Currency currency = Currency.getInstance(loc);
        return currency.getDisplayName();
    }
View Full Code Here

    runBasicTests( ClassType.INSTANCE, original, copy, different );
  }

  public void testCurrencyType() {
    final Currency original = Currency.getInstance( Locale.US );
    final Currency copy = Currency.getInstance( Locale.US );
    final Currency different = Currency.getInstance( Locale.UK );

    runBasicTests( CurrencyType.INSTANCE, original, copy, different );
  }
View Full Code Here

  }

  public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
      throws HibernateException, SQLException {
    BigDecimal amt = (BigDecimal) Hibernate.BIG_DECIMAL.nullSafeGet( rs, names[0] );
    Currency cur = (Currency) Hibernate.CURRENCY.nullSafeGet( rs, names[1] );
    if ( amt == null ) return null;
    return new MonetaryAmount( amt, cur );
  }
View Full Code Here

      PreparedStatement st, Object value, int index,
      SessionImplementor session
  ) throws HibernateException, SQLException {
    MonetaryAmount ma = (MonetaryAmount) value;
    BigDecimal amt = ma == null ? null : ma.getAmount();
    Currency cur = ma == null ? null : ma.getCurrency();
    Hibernate.BIG_DECIMAL.nullSafeSet( st, amt, index );
    Hibernate.CURRENCY.nullSafeSet( st, cur, index + 1 );
  }
View Full Code Here

TOP

Related Classes of java.util.Currency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.