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 java.lang.Object
An abstract base class for specifying settings related to number formatting. This class is implemented byUnlocalizedNumberRangeFormatter
andLocalizedNumberRangeFormatter
. This class is not intended for public subclassing.- Author:
- sffc
- See Also:
NumberRangeFormatter
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
collapse(NumberRangeFormatter.RangeCollapse collapse)
Sets the aggressiveness of "collapsing" fields across the range separator.boolean
equals(java.lang.Object other)
int
hashCode()
T
identityFallback(NumberRangeFormatter.RangeIdentityFallback identityFallback)
Sets the behavior when the two sides of the range are the same.T
numberFormatterBoth(UnlocalizedNumberFormatter formatter)
Sets the NumberFormatter instance to use for the numbers in the range.T
numberFormatterFirst(UnlocalizedNumberFormatter formatterFirst)
Sets the NumberFormatter instance to use for the first number in the range.T
numberFormatterSecond(UnlocalizedNumberFormatter formatterSecond)
Sets the NumberFormatter instances to use for the second number in the range.
-
-
-
Method Detail
-
numberFormatterBoth
public T numberFormatterBoth(UnlocalizedNumberFormatter formatter)
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:
NumberFormatter
,NumberRangeFormatter
-
numberFormatterFirst
public T numberFormatterFirst(UnlocalizedNumberFormatter formatterFirst)
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:
NumberFormatter
,NumberRangeFormatter
-
numberFormatterSecond
public T numberFormatterSecond(UnlocalizedNumberFormatter formatterSecond)
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:
NumberFormatter
,NumberRangeFormatter
-
collapse
public T collapse(NumberRangeFormatter.RangeCollapse 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:
NumberRangeFormatter
-
identityFallback
public T identityFallback(NumberRangeFormatter.RangeIdentityFallback 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:
NumberRangeFormatter
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
-