CollationAbstractionLayerpublic abstract class CollationAbstractionLayer extends Object The CollationAbstractionLayer class provides a layer of
abstraction for {@link javax.microedition.global.StringComparator}
realization. Sub-classes of CollationAbstractionLayer
correspond to individual implementations of string comparison. |
Fields Summary |
---|
private static final String | ABSTRACTION_LAYER_PROPERTYConstant name of collation abstraction layer class property. | private static final String | DEFAULT_ABSTRACTION_LAYERConstant name of default collation abstraction layer class. | private static CollationAbstractionLayer | abstractionLayerAn instance of CollationAbstractionLayer , which is
used in the {@link #getInstance() getInstance} method. |
Methods Summary |
---|
public static com.sun.j2me.global.CollationAbstractionLayer | getInstance()Returns an instance CollationAbstractionLayer . 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 = (CollationAbstractionLayer)
Class.forName(alClsName).newInstance();
} catch (ClassNotFoundException cnf_ignore) {
/* intentionally ignored */
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"default Collation handler class does not exist:"
+ alClsName);
}
} catch (InstantiationException ie_ignore) {
/* intentionally ignored */
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"default Collation handler class missing constructor:"
+ alClsName);
}
} catch (IllegalAccessException iae_ignore) {
/* intentionally ignored */
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"default Collation handler class incorrect type:"
+ alClsName);
}
}
}
if (abstractionLayer == null) {
// try default abstraction layer
try {
abstractionLayer = (CollationAbstractionLayer)Class.forName(
DEFAULT_ABSTRACTION_LAYER).newInstance();
} catch (ClassNotFoundException cnf_ignore) {
/* intentionally ignored */
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Default Collation handler class does not exist:"
+ DEFAULT_ABSTRACTION_LAYER);
}
} catch (InstantiationException ie_ignore) {
/* intentionally ignored */
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Collation handler class missing constructor:"
+ DEFAULT_ABSTRACTION_LAYER);
}
} catch (IllegalAccessException iae_ignore) {
/* intentionally ignored */
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR238,
"Collation handler class incorrect type:"
+ DEFAULT_ABSTRACTION_LAYER);
}
}
}
}
return abstractionLayer;
| public abstract CommonStringComparator | getStringComparator(java.lang.String locale, int level)Returns an instance of the StringComparator sub-class,
which realizes platform-specific StringComparator methods.
| public abstract java.lang.String[] | getSupportedLocales()Gets the locales for which a StringComparator is available
in individual implementation. If no locales are supported, the returned
array must be empty, not null . As the value
null is not technically a valid locale, but a special value
to trigger the generic collation algorithm, it must not appear in the
array.
|
|