com.ibm.icu.impl.ICUCurrencyDisplayInfoProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-client-compiler-deps Show documentation
Show all versions of vaadin-client-compiler-deps Show documentation
Vaadin is a web application framework for Rich Internet Applications (RIA).
Vaadin enables easy development and maintenance of fast and
secure rich web
applications with a stunning look and feel and a wide browser support.
It features a server-side architecture with the majority of the logic
running
on the server. Ajax technology is used at the browser-side to ensure a
rich
and interactive user experience.
/*
*******************************************************************************
* Copyright (C) 2009-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.impl;
import java.lang.ref.SoftReference;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import com.ibm.icu.impl.CurrencyData.CurrencyDisplayInfo;
import com.ibm.icu.impl.CurrencyData.CurrencyDisplayInfoProvider;
import com.ibm.icu.impl.CurrencyData.CurrencyFormatInfo;
import com.ibm.icu.impl.CurrencyData.CurrencySpacingInfo;
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;
public class ICUCurrencyDisplayInfoProvider implements CurrencyDisplayInfoProvider {
public ICUCurrencyDisplayInfoProvider() {
}
public CurrencyDisplayInfo getInstance(ULocale locale, boolean withFallback) {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(
ICUResourceBundle.ICU_CURR_BASE_NAME, locale);
if (!withFallback) {
int status = rb.getLoadingStatus();
if (status == ICUResourceBundle.FROM_DEFAULT || status == ICUResourceBundle.FROM_ROOT) {
return null;
}
}
return new ICUCurrencyDisplayInfo(rb, withFallback);
}
public boolean hasData() {
return true;
}
static class ICUCurrencyDisplayInfo extends CurrencyDisplayInfo {
private final boolean fallback;
private final ICUResourceBundle rb;
private final ICUResourceBundle currencies;
private final ICUResourceBundle plurals;
private SoftReference