com.ibm.icu.text

Class NumberFormat.NumberFormatFactory

public abstract static class NumberFormat.NumberFormatFactory extends Object

A NumberFormatFactory is used to register new number formats. The factory should be able to create any of the predefined formats for each locale it supports. When registered, the locales it supports extend or override the locales already supported by ICU.

Note: as of ICU4J 3.2, the default API for NumberFormatFactory uses ULocale instead of Locale. Instead of overriding createFormat(Locale, int), new implementations should override createFactory(ULocale, int). Note that one of these two methods MUST be overridden or else an infinite loop will occur.

UNKNOWN: ICU 2.6

Field Summary
static intFORMAT_CURRENCY
Value passed to format requesting a currency format.
static intFORMAT_INTEGER
Value passed to format requesting an integer format.
static intFORMAT_NUMBER
Value passed to format requesting a default number format.
static intFORMAT_PERCENT
Value passed to format requesting a percent format.
static intFORMAT_SCIENTIFIC
Value passed to format requesting a scientific format.
Constructor Summary
protected NumberFormatFactory()
Method Summary
NumberFormatcreateFormat(ULocale loc, int formatType)
Returns a number format of the appropriate type.
NumberFormatcreateFormat(Locale loc, int formatType)
Returns a number format of the appropriate type.
abstract SetgetSupportedLocaleNames()
Returns an immutable collection of the locale names directly supported by this factory.
booleanvisible()
Returns true if this factory is visible.

Field Detail

FORMAT_CURRENCY

public static final int FORMAT_CURRENCY
Value passed to format requesting a currency format.

UNKNOWN: ICU 2.6

FORMAT_INTEGER

public static final int FORMAT_INTEGER
Value passed to format requesting an integer format.

UNKNOWN: ICU 2.6

FORMAT_NUMBER

public static final int FORMAT_NUMBER
Value passed to format requesting a default number format.

UNKNOWN: ICU 2.6

FORMAT_PERCENT

public static final int FORMAT_PERCENT
Value passed to format requesting a percent format.

UNKNOWN: ICU 2.6

FORMAT_SCIENTIFIC

public static final int FORMAT_SCIENTIFIC
Value passed to format requesting a scientific format.

UNKNOWN: ICU 2.6

Constructor Detail

NumberFormatFactory

protected NumberFormatFactory()

UNKNOWN: ICU 2.6

Method Detail

createFormat

public NumberFormat createFormat(ULocale loc, int formatType)
Returns a number format of the appropriate type. If the locale is not supported, return null. If the locale is supported, but the type is not provided by this service, return null. Otherwise return an appropriate instance of NumberFormat. Note: as of ICU4J 3.2, implementations should override this method instead of createFormat(Locale, int).

Parameters: loc the locale for which to create the format formatType the type of format

Returns: the NumberFormat, or null.

UNKNOWN: ICU 3.2 This API might change or be removed in a future release.

createFormat

public NumberFormat createFormat(Locale loc, int formatType)
Returns a number format of the appropriate type. If the locale is not supported, return null. If the locale is supported, but the type is not provided by this service, return null. Otherwise return an appropriate instance of NumberFormat. Note: as of ICU4J 3.2, createFormat(ULocale, int) should be overridden instead of this method. This method is no longer abstract and delegates to that method.

Parameters: loc the locale for which to create the format formatType the type of format

Returns: the NumberFormat, or null.

UNKNOWN: ICU 2.6

getSupportedLocaleNames

public abstract Set getSupportedLocaleNames()
Returns an immutable collection of the locale names directly supported by this factory.

Returns: the supported locale names.

UNKNOWN: ICU 2.6

visible

public boolean visible()
Returns true if this factory is visible. Default is true. If not visible, the locales supported by this factory will not be listed by getAvailableLocales. This value must not change.

Returns: true if the factory is visible.

UNKNOWN: ICU 2.6

Copyright (c) 2006 IBM Corporation and others.