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 ohos.global.icu.text; 11 12 import java.util.Locale; 13 import java.util.Map; 14 15 import ohos.global.icu.impl.CurrencyData; 16 import ohos.global.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 exposed on OHOS 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 */ getInstance(ULocale locale)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 */ getInstance(Locale locale)52 public static CurrencyDisplayNames getInstance(Locale locale) { 53 return getInstance(locale, false); 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 */ getInstance(ULocale locale, boolean noSubstitute)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 */ getInstance(Locale locale, boolean noSubstitute)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 OHOS 95 */ 96 @Deprecated hasData()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 */ getULocale()106 public abstract ULocale getULocale(); 107 108 /** 109 * Returns the symbol for the currency with the provided ISO code. 110 * <p> 111 * If there is no data for this symbol, substitutes isoCode, 112 * or returns null if noSubstitute was set in the factory method. 113 * 114 * @param isoCode the three-letter ISO code. 115 * @return the symbol. 116 */ getSymbol(String isoCode)117 public abstract String getSymbol(String isoCode); 118 119 /** 120 * Returns the narrow symbol for the currency with the provided ISO code. 121 * <p> 122 * The narrow currency symbol is similar to the regular currency symbol, 123 * but it always takes the shortest form; 124 * for example, "$" instead of "US$" for USD in en-CA. 125 * <p> 126 * If there is no data for this symbol, substitutes the default symbol, 127 * or returns null if noSubstitute was set in the factory method. 128 * 129 * @param isoCode the three-letter ISO code. 130 * @return the narrow symbol. 131 */ getNarrowSymbol(String isoCode)132 public abstract String getNarrowSymbol(String isoCode); 133 134 /** 135 * Returns the formal symbol for the currency with the provided ISO code. 136 * <p> 137 * The formal currency symbol is similar to the regular currency symbol, 138 * but it always takes the form used in formal settings such as banking; 139 * for example, "NT$" instead of "$" for TWD in zh-TW. 140 * <p> 141 * If there is no data for this symbol, substitutes the default symbol, 142 * or returns null if noSubstitute was set in the factory method. 143 * 144 * @param isoCode the three-letter ISO code. 145 * @return the formal symbol. 146 * @hide draft / provisional / internal are hidden on OHOS 147 */ getFormalSymbol(String isoCode)148 public abstract String getFormalSymbol(String isoCode); 149 150 /** 151 * Returns the variant symbol for the currency with the provided ISO code. 152 * <p> 153 * The variant symbol for a currency is an alternative symbol that is not 154 * necessarily as widely used as the regular symbol. 155 * <p> 156 * If there is no data for variant symbol, substitutes the default symbol, 157 * or returns null if noSubstitute was set in the factory method. 158 * 159 * @param isoCode the three-letter ISO code. 160 * @return the variant symbol. 161 * @hide draft / provisional / internal are hidden on OHOS 162 */ getVariantSymbol(String isoCode)163 public abstract String getVariantSymbol(String isoCode); 164 165 /** 166 * Returns the 'long name' for the currency with the provided ISO code. 167 * If there is no data for the ISO code, substitutes isoCode, or returns null 168 * if noSubstitute was set in the factory method. 169 * 170 * @param isoCode the three-letter ISO code 171 * @return the display name 172 */ getName(String isoCode)173 public abstract String getName(String isoCode); 174 175 /** 176 * Returns a 'plural name' for the currency with the provided ISO code corresponding to 177 * the pluralKey. If there is no data for the ISO code, substitutes isoCode or 178 * returns null. If there is data for the ISO code but no data for the plural key, 179 * substitutes the 'other' value (and failing that the isoCode) or returns null. 180 * 181 * @param isoCode the three-letter ISO code 182 * @param pluralKey the plural key, for example "one", "other" 183 * @return the display name 184 * @see ohos.global.icu.text.PluralRules 185 */ getPluralName(String isoCode, String pluralKey)186 public abstract String getPluralName(String isoCode, String pluralKey); 187 188 /** 189 * Returns a mapping from localized symbols and currency codes to currency codes. 190 * The returned map is unmodifiable. 191 * @return the map 192 */ symbolMap()193 public abstract Map<String, String> symbolMap(); 194 195 /** 196 * Returns a mapping from localized names (standard and plural) to currency codes. 197 * The returned map is unmodifiable. 198 * @return the map 199 */ nameMap()200 public abstract Map<String, String> nameMap(); 201 202 /** 203 * Sole constructor. (For invocation by subclass constructors, 204 * typically implicit.) 205 * @deprecated This API is ICU internal only. 206 * @hide draft / provisional / internal are hidden on OHOS 207 */ 208 @Deprecated CurrencyDisplayNames()209 protected CurrencyDisplayNames() { 210 } 211 } 212