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 virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
/*
*******************************************************************************
* Copyright (C) 2009-2016, 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.MissingResourceException;
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.impl.ICUResourceBundle.OpenType;
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;
public class ICUCurrencyDisplayInfoProvider implements CurrencyDisplayInfoProvider {
public ICUCurrencyDisplayInfoProvider() {
}
@Override
public CurrencyDisplayInfo getInstance(ULocale locale, boolean withFallback) {
ICUResourceBundle rb;
if (withFallback) {
rb = ICUResourceBundle.getBundleInstance(
ICUData.ICU_CURR_BASE_NAME, locale, OpenType.LOCALE_DEFAULT_ROOT);
} else {
try {
rb = ICUResourceBundle.getBundleInstance(
ICUData.ICU_CURR_BASE_NAME, locale, OpenType.LOCALE_ONLY);
} catch (MissingResourceException e) {
return null;
}
}
return new ICUCurrencyDisplayInfo(rb, withFallback);
}
@Override
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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy