Package com.ibm.icu.number
Class NumberRangeFormatterSettings<T extends NumberRangeFormatterSettings<?>>
java.lang.Object
com.ibm.icu.number.NumberRangeFormatterSettings<T>
- Direct Known Subclasses:
LocalizedNumberRangeFormatter
,UnlocalizedNumberRangeFormatter
public abstract class NumberRangeFormatterSettings<T extends NumberRangeFormatterSettings<?>>
extends Object
An abstract base class for specifying settings related to number formatting. This class is implemented by
UnlocalizedNumberRangeFormatter
and LocalizedNumberRangeFormatter
. This class is not intended for
public subclassing.- Author:
- sffc
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncollapse
(NumberRangeFormatter.RangeCollapse collapse) Sets the aggressiveness of "collapsing" fields across the range separator.boolean
int
hashCode()
identityFallback
(NumberRangeFormatter.RangeIdentityFallback identityFallback) Sets the behavior when the two sides of the range are the same.numberFormatterBoth
(UnlocalizedNumberFormatter formatter) Sets the NumberFormatter instance to use for the numbers in the range.numberFormatterFirst
(UnlocalizedNumberFormatter formatterFirst) Sets the NumberFormatter instance to use for the first number in the range.numberFormatterSecond
(UnlocalizedNumberFormatter formatterSecond) Sets the NumberFormatter instances to use for the second number in the range.
-
Method Details
-
numberFormatterBoth
Sets the NumberFormatter instance to use for the numbers in the range. The same formatter is applied to both sides of the range.The NumberFormatter instances must not have a locale applied yet; the locale specified on the NumberRangeFormatter will be used.
- Parameters:
formatter
- The formatter to use for both numbers in the range.- Returns:
- The fluent chain.
- See Also:
-
numberFormatterFirst
Sets the NumberFormatter instance to use for the first number in the range.The NumberFormatter instance must not have a locale applied yet; the locale specified on the NumberRangeFormatter will be used.
- Parameters:
formatterFirst
- The formatter to use for the first number in the range.- Returns:
- The fluent chain.
- See Also:
-
numberFormatterSecond
Sets the NumberFormatter instances to use for the second number in the range.The NumberFormatter instance must not have a locale applied yet; the locale specified on the NumberRangeFormatter will be used.
- Parameters:
formatterSecond
- The formatter to use for the second number in the range.- Returns:
- The fluent chain.
- See Also:
-
collapse
Sets the aggressiveness of "collapsing" fields across the range separator. Possible values:- ALL: "3-5K miles"
- UNIT: "3K - 5K miles"
- NONE: "3K miles - 5K miles"
- AUTO: usually UNIT or NONE, depending on the locale and formatter settings
The default value is AUTO.
- Parameters:
collapse
- The collapsing strategy to use for this range.- Returns:
- The fluent chain.
- See Also:
-
identityFallback
Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are passed to the formatRange function, or if different numbers are passed to the function but they become the same after rounding rules are applied. Possible values:- SINGLE_VALUE: "5 miles"
- APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before rounding was applied
- APPROXIMATELY: "~5 miles"
- RANGE: "5-5 miles" (with collapse=UNIT)
The default value is APPROXIMATELY.
- Parameters:
identityFallback
- The strategy to use when formatting two numbers that end up being the same.- Returns:
- The fluent chain.
- See Also:
-
hashCode
public int hashCode() -
equals
-