Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.util
Class Countries

    java.lang.Object
      org.crosswire.common.util.Countries

    public final class Countries

extends Object

A utility class that converts ISO-3166 codes or locales to their "friendly" country name.

Author:
  DM Smith
See Also:
  `The GNU Lesser General Public License for details.`

Field Summary
`static String` | `DEFAULT_COUNTRY_CODE`
`private static String` | `UNKNOWN_COUNTRY_CODE`

Constructor Summary
`private` | `Countries()` Make the class a true utility class by having a private constructor.

Method Summary
`static String` | `getCountry(String iso3166Code)` Get the country name from the country code.
`private static ResourceBundle` | `getLocalisedCountries()` Gets the localised countries.
`static boolean` | `isValidCountry(String iso3166Code)` Determine whether the country code is valid.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### 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

Constructor Detail

### Countries

    private Countries()

  Make the class a true utility class by having a private constructor.

Method Detail

### 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` - the country code
  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` - the country code
  Returns:
    the name of the country

### getLocalisedCountries

    private static ResourceBundle getLocalisedCountries()

  Gets the localised countries.

  Returns:
    the localised countries

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD