anon.util
Class CountryMapper

java.lang.Object
  extended by anon.util.AbstractISOCodeMapper
      extended by anon.util.CountryMapper

public class CountryMapper
extends AbstractISOCodeMapper

Objects of this class store a country code and can translate it into the localised name of the corresponding country.

Version:
ISO 3166 on 25.10.05
Author:
Kuno G. Gruen, Rolf Wendolsky
See Also:
http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/iso_3166-1_decoding_table.html

Field Summary
private static java.lang.String[] COUNTRIES
           
private static java.lang.String[] DEFAULT_COUNTRIES
           
private static java.lang.String MSG_CHOOSE_COUNTRY
           
 
Constructor Summary
CountryMapper()
          Constructs an empty CountryMapper object.
CountryMapper(int a_maxCountryLength)
          Constructs an empty CountryMapper object.
CountryMapper(java.lang.String a_ISO2CountryCode)
          Constructs a new CountryMapper that uses the default Locale to translate its country code.
CountryMapper(java.lang.String a_ISO2CountryCode, int a_maxCountryLength)
          Constructs a new CountryMapper that uses the default Locale to translate its country code.
CountryMapper(java.lang.String a_ISO2CountryCode, int a_maxCountryLength, java.util.Locale a_locale)
          Constructs a new CountryMapper that uses a specific Locale to translate its country code.
CountryMapper(java.lang.String a_ISO2CountryCode, java.util.Locale a_locale)
          Constructs a new CountryMapper that uses a specific Locale to translate its country code.
 
Method Summary
protected  java.lang.String getChooseMessage()
          Returns a message that is displayed when this mapped object has an empty ISO code.
protected  java.lang.String getJRETransaltionOfISOCode(java.lang.String a_ISOCountryCode, java.util.Locale a_locale)
           
static java.util.Vector getLocalisedCountries()
          Returns a Vector with CountryMappers for all officially assigned country codes.
static java.util.Vector getLocalisedCountries(int a_maxCountryLength)
          Returns a Vector with CountryMappers for all officially assigned country codes.
static java.util.Vector getLocalisedCountries(int a_maxCountryLength, java.util.Locale a_loc)
          Returns a Vector with CountryMappers for all officially assigned country codes.
static java.util.Vector getLocalisedCountries(java.util.Locale a_loc)
          Returns a Vector with CountryMappers for all officially assigned country codes.
 
Methods inherited from class anon.util.AbstractISOCodeMapper
equals, getISOCode, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_COUNTRIES

private static final java.lang.String[] DEFAULT_COUNTRIES

MSG_CHOOSE_COUNTRY

private static final java.lang.String MSG_CHOOSE_COUNTRY

COUNTRIES

private static final java.lang.String[] COUNTRIES
Constructor Detail

CountryMapper

public CountryMapper()
Constructs an empty CountryMapper object. Its toString() method returns a message that requests to choose a valid country code. The message is defined by the default Locale.


CountryMapper

public CountryMapper(int a_maxCountryLength)
Constructs an empty CountryMapper object. Its toString() method returns a message that requests to choose a valid country code. The message is defined by the default Locale.

Parameters:
a_maxCountryLength - the maximum length of the toString() output

CountryMapper

public CountryMapper(java.lang.String a_ISO2CountryCode,
                     int a_maxCountryLength)
              throws java.lang.IllegalArgumentException
Constructs a new CountryMapper that uses the default Locale to translate its country code.

Parameters:
a_ISO2CountryCode - a two-letter country code
a_maxCountryLength - the maximum length of the toString() output
Throws:
java.lang.IllegalArgumentException
See Also:
getLocalisedCountries(int)

CountryMapper

public CountryMapper(java.lang.String a_ISO2CountryCode)
              throws java.lang.IllegalArgumentException
Constructs a new CountryMapper that uses the default Locale to translate its country code.

Parameters:
a_ISO2CountryCode - a two-letter country code
Throws:
java.lang.IllegalArgumentException
See Also:
getLocalisedCountries(int)

CountryMapper

public CountryMapper(java.lang.String a_ISO2CountryCode,
                     java.util.Locale a_locale)
              throws java.lang.IllegalArgumentException
Constructs a new CountryMapper that uses a specific Locale to translate its country code.

Parameters:
a_ISO2CountryCode - a two-letter country code
a_locale - a Locale
Throws:
java.lang.IllegalArgumentException
See Also:
getLocalisedCountries(int, Locale)

CountryMapper

public CountryMapper(java.lang.String a_ISO2CountryCode,
                     int a_maxCountryLength,
                     java.util.Locale a_locale)
              throws java.lang.IllegalArgumentException
Constructs a new CountryMapper that uses a specific Locale to translate its country code.

Parameters:
a_ISO2CountryCode - a two-letter country code
a_locale - a Locale
a_maxCountryLength - the maximum length of the toString() output
Throws:
java.lang.IllegalArgumentException
See Also:
getLocalisedCountries(int, Locale)
Method Detail

getLocalisedCountries

public static java.util.Vector getLocalisedCountries()
Returns a Vector with CountryMappers for all officially assigned country codes. The constructed CountryMappers use the default locale.

Returns:
a Vector with CountryMappers for all officially assigned country codes

getLocalisedCountries

public static java.util.Vector getLocalisedCountries(java.util.Locale a_loc)
Returns a Vector with CountryMappers for all officially assigned country codes. The constructed CountryMappers use the default locale.

Parameters:
a_loc - the locale that is used in all contructed CountryMappers
Returns:
a Vector with CountryMappers for all officially assigned country codes

getLocalisedCountries

public static java.util.Vector getLocalisedCountries(int a_maxCountryLength)
Returns a Vector with CountryMappers for all officially assigned country codes. The constructed CountryMappers use the default locale.

Parameters:
a_maxCountryLength - the maximum length of the toString() output
Returns:
a Vector with CountryMappers for all officially assigned country codes

getLocalisedCountries

public static java.util.Vector getLocalisedCountries(int a_maxCountryLength,
                                                     java.util.Locale a_loc)
Returns a Vector with CountryMappers for all officially assigned country codes.

Parameters:
a_loc - the locale that is used in all constructed CountryMappers
a_maxCountryLength - the maximum length of the toString() output
Returns:
a Vector with CountryMappers for all officially assigned country codes

getChooseMessage

protected final java.lang.String getChooseMessage()
Description copied from class: AbstractISOCodeMapper
Returns a message that is displayed when this mapped object has an empty ISO code. The user is asked to choose a mapped object.

Specified by:
getChooseMessage in class AbstractISOCodeMapper
Returns:
a message that is displayed when this mapped object has an empty ISO code

getJRETransaltionOfISOCode

protected java.lang.String getJRETransaltionOfISOCode(java.lang.String a_ISOCountryCode,
                                                      java.util.Locale a_locale)
Specified by:
getJRETransaltionOfISOCode in class AbstractISOCodeMapper