Package org.apache.uima.fit.util
Class LocaleUtil
java.lang.Object
org.apache.uima.fit.util.LocaleUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic Locale
createLocale
(String localeString) This method passes through toLocale(String)
unless the provided string contains a hyphen.static Locale
passes through to getLocaleConstant.static Locale
getLocaleConstant
(String localeConstant) This method returns the locale constant for the given string.
-
Method Details
-
getLocaleConstant
This method returns the locale constant for the given string. For example, seeLocale.US
as an example locale constant. To retrieve that locale using this method, pass in the string value "US". If there is no locale constant for the passed in string, then null is returned- Parameters:
localeConstant
- a string value that names a locale constant.- Returns:
- the corresponding locale or null if there is no locale for the provided string.
-
createLocale
This method passes through toLocale(String)
unless the provided string contains a hyphen. If it does, then the string is split on the hyphen and the resulting strings are passed into the multi-parameter constructors of Locale. The passed in string should not contain more than two hyphens as the Locale constructor with the most params is three.- Parameters:
localeString
- the locale string- Returns:
- the parsed locale
-
getLocale
passes through to getLocaleConstant. If this returns null, then this method passes through to createLocale.- Parameters:
localeString
- the locale string- Returns:
- the parsed locale
-