java.text.spi

Class 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 NumberFormatgetCurrencyInstance(Locale locale)
Returns a NumberFormat instance for monetary values in the specified Locale.
abstract NumberFormatgetIntegerInstance(Locale locale)
Returns a NumberFormat instance for integers in the specified Locale.
abstract NumberFormatgetNumberInstance(Locale locale)
Returns a general-purpose NumberFormat instance in the specified Locale.
abstract NumberFormatgetPercentInstance(Locale locale)
Returns a NumberFormat instance for percentage values in the specified Locale.

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 getAvailableLocales()

See Also: getCurrencyInstance

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 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 getAvailableLocales()

See Also: getIntegerInstance HALF_EVEN 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 getAvailableLocales()

See Also: getNumberInstance

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 getAvailableLocales()

See Also: getPercentInstance