FormatAbstractionLayerpublic abstract class FormatAbstractionLayer extends Object The FormatAbstractionLayer class provides a layer of
abstraction for {@link javax.microedition.global.Formatter}
realization. Sub-classes of FormatAbstractionLayer
correspond to individual implementations of data formatting. |
Fields Summary |
---|
private static final String | ABSTRACTION_LAYER_PROPERTYConstant name of formatting abstraction layer class property. | private static final String | DEFAULT_ABSTRACTION_LAYERConstant name of default formatting abstraction layer class. | private static FormatAbstractionLayer | abstractionLayerAn instance of FormatAbstractionLayer , which is
used in the {@link #getInstance} method. | private static CommonFormatter | neutralFormatterAn instance of NeutralFormatterImpl , which is
used in the {@link #getNeutralFormatter} method. |
Methods Summary |
---|
public abstract CommonFormatter | getFormatter(java.lang.String locale)Returns an instance of the Formatter sub-class, which
realizes platform-specific Formatter methods.
| public static com.sun.j2me.global.FormatAbstractionLayer | getInstance()Returns an instance FormatAbstractionLayer . This
instance is created only once (singleton) and then it is reused when
the method is called again.
if (abstractionLayer == null) {
String alClsName =
Configuration.getProperty(ABSTRACTION_LAYER_PROPERTY);
if (alClsName != null) {
try {
abstractionLayer = (FormatAbstractionLayer)
Class.forName(alClsName).newInstance();
} catch (ClassNotFoundException cnf_ignore) {
/* intentionally ignored */
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Formatter handler class does not exist or renamed: " + alClsName);
} catch (InstantiationException ie_ignore) {
/* intentionally ignored */
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Formatter handler class missing constructor: "
+ alClsName);
} catch (IllegalAccessException iae_ignore) {
/* intentionally ignored */
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Formatter handler class incorrect type: "
+ alClsName);
}
}
if (abstractionLayer == null) {
// try default abstraction layer
try {
abstractionLayer = (FormatAbstractionLayer)Class.forName(
DEFAULT_ABSTRACTION_LAYER).newInstance();
} catch (ClassNotFoundException cnf_ignore) {
/* intentionally ignored */
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Default Formatter handler class does not exist or renamed: "
+ DEFAULT_ABSTRACTION_LAYER);
} catch (InstantiationException ie_ignore) {
/* intentionally ignored */
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Formatter handler class missing constructor: "
+ DEFAULT_ABSTRACTION_LAYER);
} catch (IllegalAccessException iae_ignore) {
/* intentionally ignored */
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Formatter handler class incorrect type: "
+ DEFAULT_ABSTRACTION_LAYER);
}
}
}
return abstractionLayer;
| public static CommonFormatter | getNeutralFormatter()Returns an instance NeutralFormatterImpl . This
instance is created only once (singleton) and then it is reused when
the method is called again.
if (neutralFormatter == null) {
neutralFormatter = new NeutralFormatterImpl();
}
return neutralFormatter;
| public abstract 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.
|
|