Package com.highdeal.currency
Class CurrencyHelper
java.lang.Object
com.highdeal.currency.CurrencyHelper
This
Java class is a tool to work with currencies.
For some of its methods, it is expected as prerequisite that the class
Currency is initialized with a CurrencyBook.-
Method Summary
Modifier and TypeMethodDescriptionstatic final StringgetCurrencyISOCodeOrCode(Currency currency) Returns the ISO code or the code of a currency whether the currency has an ISO code or not.static final StringgetCurrencyISOCodeOrCode(String currencyCode) Returns the ISO code or the code of a currency whether the currency has an ISO code or not.
-
Method Details
-
getCurrencyISOCodeOrCode
Returns the ISO code or the code of a currency whether the currency has an ISO code or not.Example
With the following
CurrencyBook:
here are some examples which shows the behavior of this method:Currency Code Currency ISO Code EUR EUR USDN USD PNT nullcurrencyCodeMethod Result EUR EUR USDN USD PNT PNT UNK UNK nullthrows NullPointerException- Parameters:
currencyCode- The code of the currency for which its ISO code or its code must be returned- Returns:
- The ISO code if specified,
currencyCodeotherwise i.e. if no currency hascurrencyCodeas code or if the currency has no ISO code. - Throws:
NullPointerException- if the classcurrencyis notinitializedwith aCurrencyBookor ifcurrencyCodeisnull
-
getCurrencyISOCodeOrCode
Returns the ISO code or the code of a currency whether the currency has an ISO code or not.- Parameters:
currency- The currency for which its ISO code or its code must be returned- Returns:
- The ISO code of
currencyif specified, the code of the currency otherwise. - Throws:
NullPointerException- ifcurrencyisnull.
-