Golibri

org.golibri.iso
Class CurrencyCodes

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

public final class CurrencyCodes
extends java.lang.Object

The CurrencyCodes class contains all 3-character currency codes as specified by the ISO 4217 Standard. The class allows to create CurrencyCode objects that are verified againsts the existing set of currency codes in the ISO 4217 Standard. The full set of currency codes can be found in the resource file org/golibri/iso/currencycodes.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 CurrencyCodes class is for working specifically with currency codes. The preferred way to represent currencies is with org.golibri.common.finance.Currency.

See Also:
CurrencyCode, Currency

Constructor Summary
CurrencyCodes()
           
 
Method Summary
static boolean exists(CurrencyCode currencyCode)
          Static method to check whether a currency code exists.
static boolean exists(java.lang.String currencyCode)
          Static method to check whether a currency code exists.
static CurrencyCode getCurrencyCode(java.lang.String currencyCode)
          Static factory method to create currency code objects.
static CurrencyCode[] getCurrencyCodes()
          Static method that returns all existing currency codes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrencyCodes

public CurrencyCodes()
Method Detail

getCurrencyCode

public static CurrencyCode getCurrencyCode(java.lang.String currencyCode)
Static factory method to create currency code objects. Constructing a CurrencyCode object through this method also requires the currency code to exist in the ISO 4217 Standard.

Parameters:
currencyCode - String parameter containing the currency code
Throws:
java.lang.NullPointerException - If the parameter currencyCode is null
java.lang.IllegalArgumentException - If the parameter currencyCode is not well-formatted or does not exist in the ISO 4217 Standard

getCurrencyCodes

public static CurrencyCode[] getCurrencyCodes()
Static method that returns all existing currency codes.

Returns:
an array of CurrencyCode objects containing all existing currency codes

exists

public static boolean exists(CurrencyCode currencyCode)
Static method to check whether a currency code exists. This method can be used to perform a check on CurrencyCode objects that were not created with the factory method getCurrencyCode or when the origin of the objects is incertain.

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

exists

public static boolean exists(java.lang.String currencyCode)
Static method to check whether a currency code exists. This method can be be used to perform a check before getCurrencyCode() is called to avoid receiving an IllegalArgumentException.

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

Golibri