Class AbstractNumberFormatFactory

java.lang.Object
org.springframework.binding.format.AbstractNumberFormatFactory
All Implemented Interfaces:
NumberFormatFactory
Direct Known Subclasses:
CurrencyNumberFormatFactory, DefaultNumberFormatFactory, IntegerNumberFormatFactory, PercentNumberFormatFactory

public abstract class AbstractNumberFormatFactory extends Object implements NumberFormatFactory
Base class suitable for subclassing by most NumberFormatFactory implementations.
Author:
Keith Donald
  • Constructor Details

    • AbstractNumberFormatFactory

      public AbstractNumberFormatFactory()
  • Method Details

    • getLocale

      public Locale getLocale()
      The locale to use in formatting number values. If null, the locale associated with the current thread is used.
      Returns:
      the locale
      See Also:
      • LocaleContextHolder.getLocale()
    • setLocale

      public void setLocale(Locale locale)
      Sets the locale to use in formatting number values.
      Parameters:
      locale - the locale
    • getNumberFormat

      public final NumberFormat getNumberFormat()
      Description copied from interface: NumberFormatFactory
      Factory method that returns a fully-configured NumberFormat instance to use to format an object for display.
      Specified by:
      getNumberFormat in interface NumberFormatFactory
      Returns:
      the number format
    • getNumberFormat

      protected abstract NumberFormat getNumberFormat(Locale locale)
      Subclasses should override to create the new NumberFormat instance.
      Parameters:
      locale - the locale to use
      Returns:
      the number format