Golibri

org.golibri.iso
Class Alpha3CountryCodes

java.lang.Object
  extended byorg.golibri.iso.Alpha3CountryCodes

public final class Alpha3CountryCodes
extends java.lang.Object

The Alpha3CountryCodes class contains all alpha-3 country codes as specified by the ISO 3166 Standard. The class allows to create Alpha3CountryCode objects that are verified againsts the existing set of alpha-3 country codes in the ISO 3166 Standard. The full set of alpha-3 country codes can be found in the resource file org/golibri/iso/countrycodes.xml. This resource file can be found in the zip-file golibri-resources.zip which comes with each golibri distribution. If needed the XML-file can be updated or changed to serve your own needs. The Alpha3CountryCodes class is for working specifically with alpha-3 country codes. The preferred way to represent countries is with org.golibri.common.contact.Country.

See Also:
Alpha3CountryCode, Country

Constructor Summary
Alpha3CountryCodes()
           
 
Method Summary
static boolean exists(Alpha3CountryCode countryCode)
          Method to check whether an alpha-3 country code exists.
static boolean exists(java.lang.String countryCode)
          Method to check whether an alpha-2 country code exists.
static Alpha3CountryCode getCountryCode(java.lang.String countryCode)
          Factory method to create alpha-3 country code objects.
static Alpha3CountryCode[] getCountryCodes()
          Static method that returns all existing alpha-3 country codes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alpha3CountryCodes

public Alpha3CountryCodes()
Method Detail

getCountryCode

public static Alpha3CountryCode getCountryCode(java.lang.String countryCode)
Factory method to create alpha-3 country code objects. Constructing a Alpha3CountryCode through this method also requires the country code to exist in the ISO 3166 Standard.

Parameters:
countryCode - String parameter containing the alpha-3 country code
Throws:
java.lang.NullPointerException - If the parameter countryCode is null
java.lang.IllegalArgumentException - If the parameter countryCode is not well-formatted or does not exist in the ISO 3166 Standard

getCountryCodes

public static Alpha3CountryCode[] getCountryCodes()
Static method that returns all existing alpha-3 country codes.

Returns:
an array of Alpha3CountryCode objects containing all existing alpha-3 country codes

exists

public static boolean exists(Alpha3CountryCode countryCode)
Method to check whether an alpha-3 country code exists. This method can be used to perform a check on Alpha3CountryCode objects that were not created with the factory method getCountryCode or when the origin of the objects is incertain.

Parameters:
countryCode - The alpha-3 country code that needs to be checked
Returns:
true if the country code exists, false otherwise

exists

public static boolean exists(java.lang.String countryCode)
Method to check whether an alpha-2 country code exists. This method can be be used to perform a check before getCountryCode() is called to avoid receiving an IllegalArgumentException.

Parameters:
countryCode - The country code that needs to be checked
Returns:
true if the country code exists, false otherwise

Golibri