java.text.spi
Class NumberFormatProvider

java.lang.Object
  extended by java.util.spi.LocaleServiceProvider
      extended by java.text.spi.NumberFormatProvider

public abstract class NumberFormatProvider
extends LocaleServiceProvider

A NumberFormatProvider provides localized instances of NumberFormat.

Since:
1.6

Constructor Summary
protected NumberFormatProvider()
          Constructs a new NumberFormatProvider.
 
Method Summary
abstract  NumberFormat getCurrencyInstance(Locale locale)
          Returns a NumberFormat instance for monetary values in the specified Locale.
abstract  NumberFormat getIntegerInstance(Locale locale)
          Returns a NumberFormat instance for integers in the specified Locale.
abstract  NumberFormat getNumberInstance(Locale locale)
          Returns a general-purpose NumberFormat instance in the specified Locale.
abstract  NumberFormat getPercentInstance(Locale locale)
          Returns a NumberFormat instance for percentage values in the specified Locale.
 
Methods inherited from class java.util.spi.LocaleServiceProvider
getAvailableLocales
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberFormatProvider

protected NumberFormatProvider()
Constructs a new NumberFormatProvider. Provided for implicit invocation by subclasses.

Method Detail

getCurrencyInstance

public abstract NumberFormat getCurrencyInstance(Locale locale)
Returns a NumberFormat instance for monetary values in the specified Locale.

Parameters:
locale - the desired locale.
Returns:
the localized instance for monetary values.
Throws:
NullPointerException - if the locale is null.
IllegalArgumentException - if the locale is not one returned by LocaleServiceProvider.getAvailableLocales()
See Also:
NumberFormat.getCurrencyInstance(java.util.Locale)

getIntegerInstance

public abstract NumberFormat getIntegerInstance(Locale locale)
Returns a NumberFormat instance for integers in the specified Locale. The returned instance should be configured to round floating point numbers to the nearest integer using RoundingMode.HALF_EVEN rounding, and to parse only the integer part of a number.

Parameters:
locale - the desired locale.
Returns:
the localized instance for integers.
Throws:
NullPointerException - if the locale is null.
IllegalArgumentException - if the locale is not one returned by LocaleServiceProvider.getAvailableLocales()
See Also:
NumberFormat.getIntegerInstance(java.util.Locale), RoundingMode.HALF_EVEN, NumberFormat.isParseIntegerOnly()

getNumberInstance

public abstract NumberFormat getNumberInstance(Locale locale)
Returns a general-purpose NumberFormat instance in the specified Locale.

Parameters:
locale - the desired locale.
Returns:
a general-purpose localized instance.
Throws:
NullPointerException - if the locale is null.
IllegalArgumentException - if the locale is not one returned by LocaleServiceProvider.getAvailableLocales()
See Also:
NumberFormat.getNumberInstance(java.util.Locale)

getPercentInstance

public abstract NumberFormat getPercentInstance(Locale locale)
Returns a NumberFormat instance for percentage values in the specified Locale.

Parameters:
locale - the desired locale.
Returns:
the localized instance for percentage values.
Throws:
NullPointerException - if the locale is null.
IllegalArgumentException - if the locale is not one returned by LocaleServiceProvider.getAvailableLocales()
See Also:
NumberFormat.getPercentInstance(java.util.Locale)