Golibri

org.golibri.iso
Class Alpha2LanguageCodes

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

public final class Alpha2LanguageCodes
extends java.lang.Object

The Alpha2LanguageCodes class contains all alpha-2 language codes as specified by the ISO 639 Standard. The class allows to create Alpha2LanguageCode objects that are verified againsts the existing set of alpha-2 language codes in the ISO 639 Standard. The full set of alpha-2 language codes can be found in the resource file org/golibri/iso/languagecodes.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 Alpha2LanguageCodes class is for working specifically with alpha-2 language codes. The preferred way to represent languages is with org.golibri.common.Language.

See Also:
Alpha2LanguageCode, Language

Constructor Summary
Alpha2LanguageCodes()
           
 
Method Summary
static boolean exists(Alpha2LanguageCode alpha2LanguageCode)
          Static method to check whether an alpha-2 language code exists.
static boolean exists(java.lang.String alpha2LanguageCode)
          Static method to check whether an alpha-2 language code exists.
static Alpha2LanguageCode getAlpha2LanguageCode(java.lang.String alpha2LanguageCode)
          Static factory method to create alpha-2 language code objects.
static Alpha2LanguageCode[] getAlpha2LanguageCodes()
          Static method that returns all existing alpha-2 language codes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alpha2LanguageCodes

public Alpha2LanguageCodes()
Method Detail

getAlpha2LanguageCode

public static Alpha2LanguageCode getAlpha2LanguageCode(java.lang.String alpha2LanguageCode)
Static factory method to create alpha-2 language code objects. Constructing a Alpha2LanguageCode object through this method also requires the alpha-2 language code to exist in the ISO 639 Standard.

Parameters:
alpha2LanguageCode - String parameter containing the alpha-2 language code
Throws:
java.lang.NullPointerException - If the parameter alpha2LanguageCode is null
java.lang.IllegalArgumentException - If the parameter alpha2LanguageCode is not well-formatted or does not exist in the ISO 639 Standard

getAlpha2LanguageCodes

public static Alpha2LanguageCode[] getAlpha2LanguageCodes()
Static method that returns all existing alpha-2 language codes.

Returns:
an array of Alpha2LanguageCode objects containing all existing alpha-2 language codes

exists

public static boolean exists(Alpha2LanguageCode alpha2LanguageCode)
Static method to check whether an alpha-2 language code exists. This method can be used to perform a check on Alpha2LanguageCode objects that were not created with the factory method getAlpha2LanguageCode or when the origin of the objects is incertain.

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

exists

public static boolean exists(java.lang.String alpha2LanguageCode)
Static method to check whether an alpha-2 language code exists. This method can be be used to perform a check before getAlpha2LanguageCode() is called to avoid receiving an IllegalArgumentException.

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

Golibri