java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.formatters.number.LocaleNumberFormatter
All Implemented Interfaces:
NumberFormatter

public class LocaleNumberFormatter extends Object implements NumberFormatter
A locale-aware implementation of the NumberFormatter interface that formats numeric values using the default number format for the locale provided by a LocaleProvider.

This class is used throughout the message formatting pipeline to produce human-readable, properly localized number strings (e.g., for coordinates, quantities, etc.).

For example, the number 12345.67 might be formatted as "12,345.67" in Locale.US, or as "12 345,67" in Locale.FRANCE, depending on the locale.

See Also:
  • Constructor Details

    • LocaleNumberFormatter

      public LocaleNumberFormatter(LocaleProvider localeProvider)
      Constructs a new LocaleNumberFormatter with the given locale provider.
      Parameters:
      localeProvider - a provider of Locale instances used for formatting
  • Method Details

    • getFormatted

      public String getFormatted(Number number)
      Formats the specified number using the NumberFormat instance associated with the locale provided by the LocaleProvider.
      Specified by:
      getFormatted in interface NumberFormatter
      Parameters:
      number - the number to format
      Returns:
      a localized string representation of the number