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#License 4package android.icu.number; 5 6import java.util.Locale; 7 8import 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 specified. 12 * 13 * @see NumberFormatter 14 * @hide Only a subset of ICU is exposed in Android 15 * @hide draft / provisional / internal are hidden on Android 16 */ 17public class UnlocalizedNumberFormatter extends NumberFormatterSettings<UnlocalizedNumberFormatter> { 18 19 /** Base constructor; called during startup only. Sets the threshold to the default value of 3. */ 20 UnlocalizedNumberFormatter() { 21 super(null, KEY_THRESHOLD, new Long(3)); 22 } 23 24 UnlocalizedNumberFormatter(NumberFormatterSettings<?> parent, int key, Object value) { 25 super(parent, key, value); 26 } 27 28 /** 29 * Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols, 30 * formats, and other data for number display. 31 * 32 * <p> 33 * To use the Java default locale, call Locale.getDefault(): 34 * 35 * <pre> 36 * NumberFormatter.with(). ... .locale(Locale.getDefault()) 37 * </pre> 38 * 39 * @param locale 40 * The locale to use when loading data for number formatting. 41 * @return The fluent chain 42 * @hide draft / provisional / internal are hidden on Android 43 */ 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 * @hide draft / provisional / internal are hidden on Android 56 */ 57 public LocalizedNumberFormatter locale(ULocale locale) { 58 return new LocalizedNumberFormatter(this, KEY_LOCALE, locale); 59 } 60 61 @Override 62 UnlocalizedNumberFormatter create(int key, Object value) { 63 return new UnlocalizedNumberFormatter(this, key, value); 64 } 65}