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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
private final NumberRangeFormatterSettings<?>
private RangeMacroProps
private final Object
-
Constructor Summary
ConstructorsConstructorDescriptionNumberRangeFormatterSettings
(NumberRangeFormatterSettings<?> parent, int key, Object value) -
Method Summary
Modifier and TypeMethodDescriptioncollapse
(NumberRangeFormatter.RangeCollapse collapse) Sets the aggressiveness of "collapsing" fields across the range separator.(package private) abstract T
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.(package private) RangeMacroProps
resolve()
-
Field Details
-
KEY_MACROS
static final int KEY_MACROS- See Also:
-
KEY_LOCALE
static final int KEY_LOCALE- See Also:
-
KEY_FORMATTER_1
static final int KEY_FORMATTER_1- See Also:
-
KEY_FORMATTER_2
static final int KEY_FORMATTER_2- See Also:
-
KEY_SAME_FORMATTERS
static final int KEY_SAME_FORMATTERS- See Also:
-
KEY_COLLAPSE
static final int KEY_COLLAPSE- See Also:
-
KEY_IDENTITY_FALLBACK
static final int KEY_IDENTITY_FALLBACK- See Also:
-
KEY_MAX
static final int KEY_MAX- See Also:
-
parent
-
key
private final int key -
value
-
resolvedMacros
-
-
Constructor Details
-
NumberRangeFormatterSettings
NumberRangeFormatterSettings(NumberRangeFormatterSettings<?> parent, int key, Object value)
-
-
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:
-
create
-
resolve
RangeMacroProps resolve() -
hashCode
public int hashCode() -
equals
-