org.crosswire.common.util
Class Countries
java.lang.Object
org.crosswire.common.util.Countries
public class Countries
- extends Object
A utility class that converts ISO-3166 codes or locales to their "friendly" country name.
- Author:
- DM Smith [dmsmith555 at yahoo dot com]
- See Also:
for license details.
The copyright to this program is held by it's authors.
Constructor Summary |
private |
Countries()
Make the class a true utility class by having a private constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_COUNTRY_CODE
public static final String DEFAULT_COUNTRY_CODE
- See Also:
- Constant Field Values
UNKNOWN_COUNTRY_CODE
private static final String UNKNOWN_COUNTRY_CODE
- See Also:
- Constant Field Values
countries
private static ResourceBundle countries
Countries
private Countries()
- Make the class a true utility class by having a private constructor.
isValidCountry
public static boolean isValidCountry(String iso3166Code)
- Determine whether the country code is valid.
The code is valid if it is null or empty.
The code is valid if it is in iso3166.properties.
If a locale is used for the iso3166Code, it will use the part after the '_'.
Thus, this code does not support dialects.
- Parameters:
iso3166Code
-
- Returns:
- true if the country is valid.
getCountry
public static String getCountry(String iso3166Code)
- Get the country name from the country code.
If the code is null or empty then it is considered to be DEFAULT_COUNTRY_CODE (that is, US).
Otherwise, it will generate a log message and return unknown.
If a locale is used for the iso3166Code, it will use the part before the '_'.
Thus, this code does not support dialects, except as found in the iso3166.
- Parameters:
iso3166Code
-
- Returns:
- the name of the country