All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ibm.icu.number.UnlocalizedNumberRangeFormatter Maven / Gradle / Ivy

Go to download

International Component for Unicode for Java (ICU4J) is a mature, widely used Java library providing Unicode and Globalization support

The newest version!
// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
package com.ibm.icu.number;

import java.util.Locale;

import com.ibm.icu.util.ULocale;

/**
 * A NumberRangeFormatter that does not yet have a locale. In order to format, a locale must be specified.
 *
 * Instances of this class are immutable and thread-safe.
 *
 * @author sffc
 * @stable ICU 63
 * @see NumberRangeFormatter
 */
public class UnlocalizedNumberRangeFormatter extends NumberRangeFormatterSettings {

    /** Base constructor; called during startup only. */
    UnlocalizedNumberRangeFormatter() {
        super(null, KEY_MACROS, null);
    }

    UnlocalizedNumberRangeFormatter(NumberRangeFormatterSettings parent, int key, Object value) {
        super(parent, key, value);
    }

    /**
     * Associate the given locale with the number range formatter. The locale is used for picking the
     * appropriate symbols, formats, and other data for number display.
     *
     * 

* To use the Java default locale, call Locale.getDefault(): * *

     * NumberFormatter.with(). ... .locale(Locale.getDefault())
     * 
* * @param locale * The locale to use when loading data for number range formatting. * @return The fluent chain * @stable ICU 63 */ public LocalizedNumberRangeFormatter locale(Locale locale) { return new LocalizedNumberRangeFormatter(this, KEY_LOCALE, ULocale.forLocale(locale)); } /** * ULocale version of the {@link #locale(Locale)} setter above. * * @param locale * The locale to use when loading data for number range formatting. * @return The fluent chain * @see #locale(Locale) * @stable ICU 63 */ public LocalizedNumberRangeFormatter locale(ULocale locale) { return new LocalizedNumberRangeFormatter(this, KEY_LOCALE, locale); } @Override UnlocalizedNumberRangeFormatter create(int key, Object value) { return new UnlocalizedNumberRangeFormatter(this, key, value); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy