java.text.spi

Class NumberFormatProvider

public abstract class NumberFormatProvider extends LocaleServiceProvider

A {@link NumberFormatProvider} provides localized instances of {@link java.text.NumberFormat}.

Since: 1.6

Constructor Summary
protected NumberFormatProvider()
Constructs a new {@link NumberFormatProvider}.
Method Summary
abstract NumberFormatgetCurrencyInstance(Locale locale)
Returns a {@link java.text.NumberFormat} instance for monetary values in the specified {@link java.util.Locale}.
abstract NumberFormatgetIntegerInstance(Locale locale)
Returns a {@link java.text.NumberFormat} instance for integers in the specified {@link java.util.Locale}.
abstract NumberFormatgetNumberInstance(Locale locale)
Returns a general-purpose {@link java.text.NumberFormat} instance in the specified {@link java.util.Locale}.
abstract NumberFormatgetPercentInstance(Locale locale)
Returns a {@link java.text.NumberFormat} instance for percentage values in the specified {@link java.util.Locale}.

Constructor Detail

NumberFormatProvider

protected NumberFormatProvider()
Constructs a new {@link NumberFormatProvider}. Provided for implicit invocation by subclasses.

Method Detail

getCurrencyInstance

public abstract NumberFormat getCurrencyInstance(Locale locale)
Returns a {@link java.text.NumberFormat} instance for monetary values in the specified {@link java.util.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 {@link getAvailableLocales()}

See Also: getCurrencyInstance

getIntegerInstance

public abstract NumberFormat getIntegerInstance(Locale locale)
Returns a {@link java.text.NumberFormat} instance for integers in the specified {@link java.util.Locale}. The returned instance should be configured to round floating point numbers to the nearest integer using {@link java.math.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 {@link getAvailableLocales()}

See Also: getIntegerInstance HALF_EVEN isParseIntegerOnly

getNumberInstance

public abstract NumberFormat getNumberInstance(Locale locale)
Returns a general-purpose {@link java.text.NumberFormat} instance in the specified {@link java.util.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 {@link getAvailableLocales()}

See Also: getNumberInstance

getPercentInstance

public abstract NumberFormat getPercentInstance(Locale locale)
Returns a {@link java.text.NumberFormat} instance for percentage values in the specified {@link java.util.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 {@link getAvailableLocales()}

See Also: getPercentInstance