Class 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:
  • Field Details

  • Constructor Details

  • Method Details

    • 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:
    • 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:
    • formatRange

      public FormattedNumberRange formatRange(Number first, 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:
      IllegalArgumentException - if first or second is null
      See Also:
    • formatImpl

      FormattedNumberRange formatImpl(DecimalQuantity first, DecimalQuantity second, boolean equalBeforeRounding)
    • create

      LocalizedNumberRangeFormatter create(int key, Object value)
      Specified by:
      create in class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>