com.senn.magic.util
Class CountryUtils

java.lang.Object
  extended by com.senn.magic.util.CountryUtils

public final class CountryUtils
extends Object

This is a specific class dedicated to finding the country code from a country name or vice versa.
Examples:

NOTE:
Every name and code returned from this class' methods will be in UPPERCASE. It is also recommended to work with uppercase values when accessing this class' methods.

Since:
3.2
Author:
Bart Thierens
Last modification: 25/02/2010

Method Summary
static String findCountryCode(String countryName)
          Find the country code of a country.
static String findCountryName(String countryCode)
          Find the country name from a country code.
static Map<String,String> getCountryCodes()
          Returns all countries with their corresponding code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCountryCodes

public static Map<String,String> getCountryCodes()
Returns all countries with their corresponding code.

Returns:
Map - a Map containing the countries and their code

findCountryCode

public static String findCountryCode(String countryName)
Find the country code of a country.

Parameters:
countryName - the name of the country
Returns:
String - the country code, or null if the country doesn't exist

findCountryName

public static String findCountryName(String countryCode)
Find the country name from a country code.

Parameters:
countryCode - the code of the country
Returns:
String - the country name, or null if the country doesn't exist