1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // © 2017 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html 4 package android.icu.number; 5 6 import java.util.Locale; 7 8 import android.icu.util.ULocale; 9 10 /** 11 * A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be 12 * specified. 13 * 14 * Instances of this class are immutable and thread-safe. 15 * 16 * @see NumberFormatter 17 */ 18 public class UnlocalizedNumberFormatter extends NumberFormatterSettings<UnlocalizedNumberFormatter> { 19 20 /** Base constructor; called during startup only. Sets the threshold to the default value of 3. */ UnlocalizedNumberFormatter()21 UnlocalizedNumberFormatter() { 22 super(null, KEY_THRESHOLD, 3L); 23 } 24 UnlocalizedNumberFormatter(NumberFormatterSettings<?> parent, int key, Object value)25 UnlocalizedNumberFormatter(NumberFormatterSettings<?> parent, int key, Object value) { 26 super(parent, key, value); 27 } 28 29 /** 30 * Associate the given locale with the number formatter. The locale is used for picking the 31 * appropriate symbols, formats, and other data for number display. 32 * 33 * <p> 34 * To use the Java default locale, call Locale.getDefault(): 35 * 36 * <pre> 37 * NumberFormatter.with(). ... .locale(Locale.getDefault()) 38 * </pre> 39 * 40 * @param locale 41 * The locale to use when loading data for number formatting. 42 * @return The fluent chain 43 */ locale(Locale locale)44 public LocalizedNumberFormatter locale(Locale locale) { 45 return new LocalizedNumberFormatter(this, KEY_LOCALE, ULocale.forLocale(locale)); 46 } 47 48 /** 49 * ULocale version of the {@link #locale(Locale)} setter above. 50 * 51 * @param locale 52 * The locale to use when loading data for number formatting. 53 * @return The fluent chain 54 * @see #locale(Locale) 55 */ locale(ULocale locale)56 public LocalizedNumberFormatter locale(ULocale locale) { 57 return new LocalizedNumberFormatter(this, KEY_LOCALE, locale); 58 } 59 60 @Override create(int key, Object value)61 UnlocalizedNumberFormatter create(int key, Object value) { 62 return new UnlocalizedNumberFormatter(this, key, value); 63 } 64 } 65