Package com.ibm.icu.number
Class LocalizedNumberRangeFormatter
- java.lang.Object
-
- com.ibm.icu.number.NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>
-
- com.ibm.icu.number.LocalizedNumberRangeFormatter
-
public class LocalizedNumberRangeFormatter extends NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>
A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available. Instances of this class are immutable and thread-safe.- See Also:
NumberRangeFormatter
-
-
Field Summary
Fields Modifier and Type Field Description private NumberRangeFormatterImpl
fImpl
-
Fields inherited from class com.ibm.icu.number.NumberRangeFormatterSettings
KEY_COLLAPSE, KEY_FORMATTER_1, KEY_FORMATTER_2, KEY_IDENTITY_FALLBACK, KEY_LOCALE, KEY_MACROS, KEY_MAX, KEY_SAME_FORMATTERS
-
-
Constructor Summary
Constructors Constructor Description LocalizedNumberRangeFormatter(NumberRangeFormatterSettings<?> parent, int key, java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) LocalizedNumberRangeFormatter
create(int key, java.lang.Object value)
(package private) FormattedNumberRange
formatImpl(DecimalQuantity first, DecimalQuantity second, boolean equalBeforeRounding)
FormattedNumberRange
formatRange(double first, double second)
Format the given doubles to a string using the settings specified in the NumberRangeFormatter fluent setting chain.FormattedNumberRange
formatRange(int first, int second)
Format the given integers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.FormattedNumberRange
formatRange(java.lang.Number first, java.lang.Number second)
Format the given Numbers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.UnlocalizedNumberRangeFormatter
withoutLocale()
Disassociate the locale from this formatter.-
Methods inherited from class com.ibm.icu.number.NumberRangeFormatterSettings
collapse, equals, hashCode, identityFallback, numberFormatterBoth, numberFormatterFirst, numberFormatterSecond, resolve
-
-
-
-
Field Detail
-
fImpl
private volatile NumberRangeFormatterImpl fImpl
-
-
Constructor Detail
-
LocalizedNumberRangeFormatter
LocalizedNumberRangeFormatter(NumberRangeFormatterSettings<?> parent, int key, java.lang.Object value)
-
-
Method Detail
-
formatRange
public FormattedNumberRange formatRange(int first, int second)
Format the given integers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.- Parameters:
first
- The first number in the range, usually to the left in LTR locales.second
- The second number in the range, usually to the right in LTR locales.- Returns:
- A FormattedNumberRange object; call .toString() to get the string.
- See Also:
NumberRangeFormatter
-
formatRange
public FormattedNumberRange formatRange(double first, double second)
Format the given doubles to a string using the settings specified in the NumberRangeFormatter fluent setting chain.- Parameters:
first
- The first number in the range, usually to the left in LTR locales.second
- The second number in the range, usually to the right in LTR locales.- Returns:
- A FormattedNumberRange object; call .toString() to get the string.
- See Also:
NumberRangeFormatter
-
formatRange
public FormattedNumberRange formatRange(java.lang.Number first, java.lang.Number second)
Format the given Numbers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.- Parameters:
first
- The first number in the range, usually to the left in LTR locales.second
- The second number in the range, usually to the right in LTR locales.- Returns:
- A FormattedNumberRange object; call .toString() to get the string.
- Throws:
java.lang.IllegalArgumentException
- if first or second is null- See Also:
NumberRangeFormatter
-
withoutLocale
public UnlocalizedNumberRangeFormatter withoutLocale()
Disassociate the locale from this formatter.- Returns:
- The fluent chain.
-
formatImpl
FormattedNumberRange formatImpl(DecimalQuantity first, DecimalQuantity second, boolean equalBeforeRounding)
-
create
LocalizedNumberRangeFormatter create(int key, java.lang.Object value)
- Specified by:
create
in classNumberRangeFormatterSettings<LocalizedNumberRangeFormatter>
-
-