FileDocCategorySizeDatePackage
FormatAbstractionLayerImpl.javaAPI DocphoneME MR2 API (J2ME)3612Wed May 02 18:00:46 BST 2007com.sun.j2me.global

FormatAbstractionLayerImpl

public class FormatAbstractionLayerImpl extends FormatAbstractionLayer
This class customizes the {@link javax.microedition.global.Formatter} implementation to rely on platform string comparison capabilities.

Fields Summary
Constructors Summary
public FormatAbstractionLayerImpl()
Create instance of FormatAbstractionLayerImpl. This constructor is necessary because of Class.forName() creation call in {@link com.sun.j2me.global.FormatAbstractionLayer#getInstance}.

 
Methods Summary
public static native intgetFormatLocaleIndex(java.lang.String locale)
Get index of supported locales for formatter by its name.

param
locale name of locale
return
index of locale

public static native java.lang.StringgetFormatLocaleName(int index)
Get one of supported locales (by number).

param
index index of locale to select
return
locale

public static native intgetFormatLocalesCount()
Get number of supported locales for data formatting.

return
number of locales

public CommonFormattergetFormatter(java.lang.String locale)
Returns an instance of the FormatterImpl class which realizes most of Formatter methods in platform-specific way.

param
locale the locale to use with this FormatterImpl
return
the instance of the FormatterImpl

        return new FormatterImpl(locale);
    
public java.lang.String[]getSupportedLocales()
Gets the list of the locales supported by the formatter, as an array of valid microedition.locale values.

If no locales are supported, the list MUST be empty. It MUST NOT be null. As the value null is not technically a valid locale, but a special value to trigger locale-neutral formatting, it MUST NOT appear in the array.

return
an array of strings containing the locale values


        int lcount = getFormatLocalesCount();
		if (lcount == 0) return new String[0];

		int index = 0;

		String locale = getFormatLocaleName(0);
		if (locale == null || locale.equals("")){
			index = 1;
		}

        String[] locales = new String[lcount-index];
        for (int i=0; index < lcount; index++) {
            locales[i++] = getFormatLocaleName(index);
        }

        return locales;