Package java.text.spi
Class NumberFormatProvider
java.lang.Object
java.util.spi.LocaleServiceProvider
java.text.spi.NumberFormatProvider
public abstract class NumberFormatProvider extends LocaleServiceProvider
This abstract class should be extended by service providers that provide
NumberFormat instances.
Note that Android does not support user-supplied locale service providers.
- Since:
- 1.6
-
Constructor Summary
Constructors Modifier Constructor Description protectedNumberFormatProvider()Default constructor, for use by subclasses. -
Method Summary
Modifier and Type Method Description abstract NumberFormatgetCurrencyInstance(Locale locale)Returns an instance ofNumberFormatthat formats monetary values for the given locale.abstract NumberFormatgetIntegerInstance(Locale locale)Returns an instance ofNumberFormatthat formats integer values for the given locale.abstract NumberFormatgetNumberInstance(Locale locale)Returns an instance ofNumberFormatclass for general use in the given locale.abstract NumberFormatgetPercentInstance(Locale locale)Returns an instance ofNumberFormatclass that formats percentage values for the given locale.Methods inherited from class java.util.spi.LocaleServiceProvider
getAvailableLocales
-
Constructor Details
-
NumberFormatProvider
protected NumberFormatProvider()Default constructor, for use by subclasses.
-
-
Method Details
-
getCurrencyInstance
Returns an instance ofNumberFormatthat formats monetary values for the given locale.- Parameters:
locale- the locale- Returns:
- an instance of
NumberFormat - Throws:
NullPointerException- iflocale == nullIllegalArgumentException- if locale isn't one of the locales returned from getAvailableLocales().
-
getIntegerInstance
Returns an instance ofNumberFormatthat formats integer values for the given locale. The returnedNumberFormatis configured to round floating point numbers to the nearest integer using half-even rounding mode for formatting, and to parse only the integer part of an input string.- Parameters:
locale- the locale- Returns:
- an instance of
NumberFormat - Throws:
NullPointerException- iflocale == nullIllegalArgumentException- if locale isn't one of the locales returned from getAvailableLocales().
-
getNumberInstance
Returns an instance ofNumberFormatclass for general use in the given locale.- Parameters:
locale- the locale- Returns:
- an instance of
NumberFormat - Throws:
NullPointerException- iflocale == nullIllegalArgumentException- if locale isn't one of the locales returned from getAvailableLocales().
-
getPercentInstance
Returns an instance ofNumberFormatclass that formats percentage values for the given locale.- Parameters:
locale- the locale- Returns:
- an instance of
NumberFormat - Throws:
NullPointerException- iflocale == nullIllegalArgumentException- if locale isn't one of the locales returned from getAvailableLocales().
-