Package com.ibm.icu.text

Examples of com.ibm.icu.text.CurrencyMetaInfo.currencies()


   *
   * @stable ICU 49
   */
  public static Set<Currency> getAvailableCurrencies() {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    List<String> list = info.currencies(CurrencyFilter.all());
    HashSet<Currency> resultSet = new HashSet<Currency>(list.size());
    for (String code : list) {
      resultSet.add(new Currency(code));
    }
    return resultSet;
View Full Code Here


    String code = currencyCodeCache.get(loc);
    if (code == null) {
      String country = loc.getCountry();

      CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
      List<String> list = info.currencies(CurrencyFilter.onRegion(country));
      if (list.size() > 0) {
        code = list.get(0);
        boolean isPreEuro = "PREEURO".equals(variant);
        if (isPreEuro && EUR_STR.equals(code)) {
          if (list.size() < 2) {
View Full Code Here

  private static synchronized Set<String> getAllCurrenciesAsSet() {
    Set<String> all = (ALL_CODES_AS_SET == null) ? null : ALL_CODES_AS_SET.get();
    if (all == null) {
      CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
      all = Collections.unmodifiableSet(new HashSet<String>(info.currencies(CurrencyFilter.all())));
      ALL_CODES_AS_SET = new SoftReference<Set<String>>(all);
    }
    return all;
  }
View Full Code Here

      return true;
    }

    // If caller passed a date range, we cannot rely solely on the cache
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    List<String> allActive = info.currencies(CurrencyFilter.onDateRange(from, to).withCurrency(code));
    return allActive.contains(code);
  }

  /**
   * Returns the list of remaining tender currencies after a filter is applied.
View Full Code Here

   *            the filter to apply to the tender currencies
   * @return a list of tender currencies
   */
  private static List<String> getTenderCurrencies(final CurrencyFilter filter) {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    return info.currencies(filter.withTender());
  }
}
//eof
View Full Code Here

     * @stable ICU 4.0
     */
    public static String[] getAvailableCurrencyCodes(ULocale loc, Date d) {
        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
        CurrencyFilter filter = CurrencyFilter.onDate(d).withRegion(loc.getCountry());
        List<String> list = info.currencies(filter);
        // Note: Prior to 4.4 the spec didn't say that we return null if there are no results, but
        // the test assumed it did.  Kept the behavior and amended the spec.
        if (list.isEmpty()) {
            return null;
        }
View Full Code Here

        }
       
        String country = loc.getCountry();
       
        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
        List<String> list = info.currencies(CurrencyFilter.onRegion(country));
        if (list.size() > 0) {
            String code = list.get(0);
            boolean isPreEuro = "PREEURO".equals(variant);
            if (isPreEuro && EUR_STR.equals(code)) {
                if (list.size() < 2) {
View Full Code Here

        }
       
        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
        if (!commonlyUsed) {
            // Behavior change from 4.3.3, no longer sort the currencies
            List<String> result = info.currencies(null);
            return result.toArray(new String[result.size()]);
        }
       
        // Don't resolve region if the requested locale is 'und', it will resolve to US
        // which we don't want.
View Full Code Here

        CurrencyFilter filter = CurrencyFilter.now().withRegion(prefRegion);
       
        // currencies are in region's preferred order when we're filtering on region, which
        // matches our spec
        List<String> result = info.currencies(filter);
       
        // No fallback anymore (change from 4.3.3)
        if (result.size() == 0) {
            return EMPTY_STRING_ARRAY;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.