Golibri

org.golibri.iso
Class CountryCodes

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

public final class CountryCodes
extends java.lang.Object

The CountryCodes class represents all country codes as specified by the ISO 3166 Standard. This class contains the alpha-2, alpha-3 and numeric-3 country codes and provides a means to link the different types of country codes with each other. This happens through the country code records which contain the different types of country codes for a single country. CountryCodes uses 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 classes Alpha2CountryCodes, Alpha3CountryCodes and Numeric3CountryCodes all use CountryCodes to verify the existence of certain country codes.

See Also:
Alpha2CountryCodes, Alpha3CountryCodes, Numeric3CountryCodes

Constructor Summary
CountryCodes()
           
 
Method Summary
static boolean alpha2CountryCodeExists(java.lang.String countryCode)
          Verifies if an alpha-2 country code exists.
static boolean alpha3CountryCodeExists(java.lang.String countryCode)
          Verifies if an alpha-3 country code exists.
static boolean countryCodeExists(java.lang.String countryCode)
          Verifies if a country code exists.
static Alpha2CountryCode getAlpha2CountryCode(java.lang.String countryCode)
          Static factory method that creates Alpha2CountryCode objects.
static Alpha2CountryCode[] getAlpha2CountryCodes()
          Static method that returns all existing alpha-2 country codes.
static Alpha3CountryCode getAlpha3CountryCode(java.lang.String countryCode)
          Static factory method that creates Alpha3CountryCode objects.
static Alpha3CountryCode[] getAlpha3CountryCodes()
          Static method that returns all existing alpha-3 country codes.
static CountryCodeRecord getCountryCodeRecord(Alpha2CountryCode alpha2CountryCode)
           
static CountryCodeRecord getCountryCodeRecord(Alpha3CountryCode alpha3CountryCode)
           
static CountryCodeRecord getCountryCodeRecord(Numeric3CountryCode numeric3CountryCode)
           
static CountryCodeRecord getCountryCodeRecord(java.lang.String countryCode)
           
static CountryCodeRecord[] getCountryCodeRecords()
           
static Numeric3CountryCode getNumeric3CountryCode(int countryCode)
          Static factory method that creates Numeric3CountryCode objects.
static Numeric3CountryCode[] getNumeric3CountryCodes()
          Static method that returns all existing numeric-3 country codes.
static boolean numeric3CountryCodeExists(int countryCode)
          Verifies if a numeric-3 country code exists.
static boolean numeric3CountryCodeExists(java.lang.String countryCode)
          Verifies if a numeric-3 country code exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountryCodes

public CountryCodes()
Method Detail

countryCodeExists

public static boolean countryCodeExists(java.lang.String countryCode)
Verifies if a country code exists.

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

alpha2CountryCodeExists

public static boolean alpha2CountryCodeExists(java.lang.String countryCode)
Verifies if an alpha-2 country code exists.

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

alpha3CountryCodeExists

public static boolean alpha3CountryCodeExists(java.lang.String countryCode)
Verifies if an alpha-3 country code exists.

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

numeric3CountryCodeExists

public static boolean numeric3CountryCodeExists(int countryCode)
Verifies if a numeric-3 country code exists.

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

numeric3CountryCodeExists

public static boolean numeric3CountryCodeExists(java.lang.String countryCode)
Verifies if a numeric-3 country code exists.

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

getAlpha2CountryCode

public static Alpha2CountryCode getAlpha2CountryCode(java.lang.String countryCode)
Static factory method that creates Alpha2CountryCode objects. The method checks if the country code exists in the ISO 3166 Standard.

Parameters:
countryCode - The country code used to create the Alpha2CountryCode object
Returns:
a valid and existing Alpha2CountryCode object
Throws:
java.lang.IllegalArgumentException - If the parameter country code is not well-formatted or does not exist

getAlpha3CountryCode

public static Alpha3CountryCode getAlpha3CountryCode(java.lang.String countryCode)
Static factory method that creates Alpha3CountryCode objects. The method checks if the country code exists in the ISO 3166 Standard.

Parameters:
countryCode - The country code used to create the Alpha3CountryCode object
Returns:
a valid and existing Alpha3CountryCode object
Throws:
java.lang.IllegalArgumentException - If the parameter country code is not well-formatted or does not exist

getNumeric3CountryCode

public static Numeric3CountryCode getNumeric3CountryCode(int countryCode)
Static factory method that creates Numeric3CountryCode objects. The method checks if the country code exists in the ISO 3166 Standard.

Parameters:
countryCode - The country code used to create the Numeric3CountryCode object
Returns:
a valid and existing Numeric3CountryCode object
Throws:
java.lang.IllegalArgumentException - If the parameter country code is not well-formatted or does not exist

getAlpha2CountryCodes

public static Alpha2CountryCode[] getAlpha2CountryCodes()
Static method that returns all existing alpha-2 country codes.

Returns:
an array of Alpha2CountryCode objects containing all existing alpha-2 country codes

getAlpha3CountryCodes

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

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

getNumeric3CountryCodes

public static Numeric3CountryCode[] getNumeric3CountryCodes()
Static method that returns all existing numeric-3 country codes.

Returns:
an array of Numeric3CountryCode objects containing all existing numeric-3 country codes

getCountryCodeRecord

public static CountryCodeRecord getCountryCodeRecord(java.lang.String countryCode)

getCountryCodeRecord

public static CountryCodeRecord getCountryCodeRecord(Alpha2CountryCode alpha2CountryCode)

getCountryCodeRecord

public static CountryCodeRecord getCountryCodeRecord(Alpha3CountryCode alpha3CountryCode)

getCountryCodeRecord

public static CountryCodeRecord getCountryCodeRecord(Numeric3CountryCode numeric3CountryCode)

getCountryCodeRecords

public static CountryCodeRecord[] getCountryCodeRecords()

Golibri