Package com.ibm.icu.text
Class Collator.CollatorFactory
- java.lang.Object
-
- com.ibm.icu.text.Collator.CollatorFactory
-
- Enclosing class:
- Collator
public abstract static class Collator.CollatorFactory extends java.lang.Object
A factory used with registerFactory to register multiple collators and provide display names for them. If standard locale display names are sufficient, Collator instances may be registered instead.Note: as of ICU4J 3.2, the default API for CollatorFactory uses ULocale instead of Locale. Instead of overriding createCollator(Locale), new implementations should override createCollator(ULocale). Note that one of these two methods MUST be overridden or else an infinite loop will occur.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CollatorFactory()
Empty default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Collator
createCollator(ULocale loc)
Return an instance of the appropriate collator.Collator
createCollator(java.util.Locale loc)
Return an instance of the appropriate collator.java.lang.String
getDisplayName(ULocale objectLocale, ULocale displayLocale)
Return the name of the collator for the objectLocale, localized for the displayLocale.java.lang.String
getDisplayName(java.util.Locale objectLocale, java.util.Locale displayLocale)
Return the name of the collator for the objectLocale, localized for the displayLocale.abstract java.util.Set<java.lang.String>
getSupportedLocaleIDs()
Return an unmodifiable collection of the locale names directly supported by this factory.boolean
visible()
Return true if this factory will be visible.
-
-
-
Method Detail
-
visible
public boolean visible()
Return true if this factory will be visible. Default is true. If not visible, the locales supported by this factory will not be listed by getAvailableLocales.- Returns:
- true if this factory is visible
-
createCollator
public Collator createCollator(ULocale loc)
Return an instance of the appropriate collator. If the locale is not supported, return null. Note: as of ICU4J 3.2, implementations should override this method instead of createCollator(Locale).- Parameters:
loc
- the locale for which this collator is to be created.- Returns:
- the newly created collator.
-
createCollator
public Collator createCollator(java.util.Locale loc)
Return an instance of the appropriate collator. If the locale is not supported, return null.Note: as of ICU4J 3.2, implementations should override createCollator(ULocale) instead of this method, and inherit this method's implementation. This method is no longer abstract and instead delegates to createCollator(ULocale).
- Parameters:
loc
- the locale for which this collator is to be created.- Returns:
- the newly created collator.
-
getDisplayName
public java.lang.String getDisplayName(java.util.Locale objectLocale, java.util.Locale displayLocale)
Return the name of the collator for the objectLocale, localized for the displayLocale. If objectLocale is not visible or not defined by the factory, return null.- Parameters:
objectLocale
- the locale identifying the collatordisplayLocale
- the locale for which the display name of the collator should be localized- Returns:
- the display name
-
getDisplayName
public java.lang.String getDisplayName(ULocale objectLocale, ULocale displayLocale)
Return the name of the collator for the objectLocale, localized for the displayLocale. If objectLocale is not visible or not defined by the factory, return null.- Parameters:
objectLocale
- the locale identifying the collatordisplayLocale
- the locale for which the display name of the collator should be localized- Returns:
- the display name
-
getSupportedLocaleIDs
public abstract java.util.Set<java.lang.String> getSupportedLocaleIDs()
Return an unmodifiable collection of the locale names directly supported by this factory.- Returns:
- the set of supported locale IDs.
-
-