1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // 2016 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html#License 4 /* 5 ******************************************************************************* 6 * Copyright (C) 2009-2016, International Business Machines Corporation and * 7 * others. All Rights Reserved. * 8 ******************************************************************************* 9 */ 10 package android.icu.text; 11 12 import java.util.Locale; 13 import java.util.Map; 14 15 import android.icu.impl.CurrencyData; 16 import android.icu.util.ULocale; 17 18 /** 19 * Returns currency names localized for a locale. 20 * 21 * This class is not intended for public subclassing. 22 * 23 * @hide Only a subset of ICU is exposed in Android 24 */ 25 public abstract class CurrencyDisplayNames { 26 /** 27 * Return an instance of CurrencyDisplayNames that provides information 28 * localized for display in the provided locale. If there is no data for the 29 * provided locale, this falls back to the current default locale; if there 30 * is no data for that either, it falls back to the root locale. Substitute 31 * values are returned from APIs when there is no data for the requested ISO 32 * code. 33 * 34 * @param locale the locale into which to localize the names 35 * @return a CurrencyDisplayNames 36 */ 37 public static CurrencyDisplayNames getInstance(ULocale locale) { 38 return CurrencyData.provider.getInstance(locale, true); 39 } 40 41 /** 42 * Return an instance of CurrencyDisplayNames that provides information 43 * localized for display in the provided locale. If there is no data for the 44 * provided locale, this falls back to the current default locale; if there 45 * is no data for that either, it falls back to the root locale. Substitute 46 * values are returned from APIs when there is no data for the requested ISO 47 * code. 48 * 49 * @param locale the locale into which to localize the names 50 * @return a CurrencyDisplayNames 51 */ 52 public static CurrencyDisplayNames getInstance(Locale locale) { 53 return getInstance(locale, true); 54 } 55 56 /** 57 * Return an instance of CurrencyDisplayNames that provides information 58 * localized for display in the provided locale. If noSubstitute is false, 59 * this behaves like {@link #getInstance(ULocale)}. Otherwise, 1) if there 60 * is no supporting data for the locale at all, there is no fallback through 61 * the default locale or root, and null is returned, and 2) if there is data 62 * for the locale, but not data for the requested ISO code, null is returned 63 * from those APIs instead of a substitute value. 64 * 65 * @param locale the locale into which to localize the names 66 * @param noSubstitute if true, do not return substitute values. 67 * @return a CurrencyDisplayNames 68 */ 69 public static CurrencyDisplayNames getInstance(ULocale locale, boolean noSubstitute) { 70 return CurrencyData.provider.getInstance(locale, !noSubstitute); 71 } 72 73 /** 74 * Return an instance of CurrencyDisplayNames that provides information 75 * localized for display in the provided locale. If noSubstitute is false, 76 * this behaves like {@link #getInstance(Locale)}. Otherwise, 1) if there 77 * is no supporting data for the locale at all, there is no fallback through 78 * the default locale or root, and null is returned, and 2) if there is data 79 * for the locale, but not data for the requested ISO code, null is returned 80 * from those APIs instead of a substitute value. 81 * 82 * @param locale the {@link java.util.Locale} into which to localize the names 83 * @param noSubstitute if true, do not return substitute values. 84 * @return a CurrencyDisplayNames 85 */ 86 public static CurrencyDisplayNames getInstance(Locale locale, boolean noSubstitute) { 87 return getInstance(ULocale.forLocale(locale), noSubstitute); 88 } 89 90 /** 91 * Returns true if currency display name data is available. 92 * @return true if currency display name data is available 93 * @deprecated This API is ICU internal only. 94 * @hide draft / provisional / internal are hidden on Android 95 */ 96 @Deprecated 97 public static boolean hasData() { 98 return CurrencyData.provider.hasData(); 99 } 100 101 /** 102 * Returns the locale used to determine how to translate the currency names. 103 * This is not necessarily the same locale passed to {@link #getInstance(ULocale)}. 104 * @return the display locale 105 */ 106 public abstract ULocale getULocale(); 107 108 /** 109 * Returns the symbol for the currency with the provided ISO code. If 110 * there is no data for the ISO code, substitutes isoCode or returns null. 111 * 112 * @param isoCode the three-letter ISO code. 113 * @return the display name. 114 */ 115 public abstract String getSymbol(String isoCode); 116 117 /** 118 * Returns the 'long name' for the currency with the provided ISO code. 119 * If there is no data for the ISO code, substitutes isoCode or returns null. 120 * 121 * @param isoCode the three-letter ISO code 122 * @return the display name 123 */ 124 public abstract String getName(String isoCode); 125 126 /** 127 * Returns a 'plural name' for the currency with the provided ISO code corresponding to 128 * the pluralKey. If there is no data for the ISO code, substitutes isoCode or 129 * returns null. If there is data for the ISO code but no data for the plural key, 130 * substitutes the 'other' value (and failing that the isoCode) or returns null. 131 * 132 * @param isoCode the three-letter ISO code 133 * @param pluralKey the plural key, for example "one", "other" 134 * @return the display name 135 * @see android.icu.text.PluralRules 136 */ 137 public abstract String getPluralName(String isoCode, String pluralKey); 138 139 /** 140 * Returns a mapping from localized symbols and currency codes to currency codes. 141 * The returned map is unmodifiable. 142 * @return the map 143 */ 144 public abstract Map<String, String> symbolMap(); 145 146 /** 147 * Returns a mapping from localized names (standard and plural) to currency codes. 148 * The returned map is unmodifiable. 149 * @return the map 150 */ 151 public abstract Map<String, String> nameMap(); 152 153 /** 154 * Sole constructor. (For invocation by subclass constructors, 155 * typically implicit.) 156 * @deprecated This API is ICU internal only. 157 * @hide draft / provisional / internal are hidden on Android 158 */ 159 @Deprecated 160 protected CurrencyDisplayNames() { 161 } 162 } 163