public class PropertyCurrencyBook extends Object implements CurrencyBook
PropertyCurrencyBook keeps the currencies that can be used in your client
application; The currencies are stored in a property resources.| Constructor and Description |
|---|
PropertyCurrencyBook()
Initializes a new property currency book from the default resource file (RESOURCE_FILE).
|
PropertyCurrencyBook(InputStream stream)
Initializes a new property currency book from a stream.
|
PropertyCurrencyBook(Locale locale)
Initializes a new property currency book from the default resource file (RESOURCE_FILE).
|
PropertyCurrencyBook(ResourceBundle bundle)
Initializes a new property currency book from a specified resource bundle
|
PropertyCurrencyBook(String fileName)
Initializes a new property currency book from a specified resource file.
|
PropertyCurrencyBook(String fileName,
Locale locale)
Initializes a new property currency book from a specified resource file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCurrency(Currency currency)
Adds a currency in the currency book.
|
static PropertyCurrencyBook |
createDefaultInstance() |
Vector<Currency> |
getCurrencies()
Returns all the current currencies that can be used in your client
application.
|
Currency |
getCurrency(int code)
Returns a currency from a given ISO 4217 code.
|
Currency |
getCurrency(String code)
Returns a currency from a specified code.
|
Currency |
getCurrency(String iso4217code,
int precision)
Returns a currency from a given ISO 4217 code and with a precision greater or equal to the given precision;
If there is no currency a given ISO 4217 code for with a precision greater or equal to the given precision, return null.
|
public PropertyCurrencyBook()
throws IOException,
MissingResourceException
IOException - if an error occurred reading the default resource fileMissingResourceException - if the resource file does not contain the
specified currency resourcespublic PropertyCurrencyBook(Locale locale) throws IOException, MissingResourceException
locale - The locale objectIOException - if an error occurred reading the default resource fileMissingResourceException - if the resource file does not contain the
specified currency resourcespublic PropertyCurrencyBook(String fileName) throws IOException, MissingResourceException
fileName - The name and path of the resource fileIOException - if an error occurred reading the specified resource fileMissingResourceException - if the resource file does not contain the
specified currency resourcespublic PropertyCurrencyBook(String fileName, Locale locale) throws IOException, MissingResourceException
fileName - The name and path of the resource filelocale - The locale objectIOException - if an error occurred reading the specified resource fileMissingResourceException - if the resource file does not contain the
specified currency resourcespublic PropertyCurrencyBook(InputStream stream) throws IOException, MissingResourceException
stream - The stream that contains the currency resourcesIOException - if an error occurred reading the streamMissingResourceException - if the stream does not contain the
specified currency resourcespublic PropertyCurrencyBook(ResourceBundle bundle) throws MissingResourceException
bundle - The resource bundle containing the currency resourcesMissingResourceException - if the resource bundle does not contain the
specified currency resourcespublic Vector<Currency> getCurrencies()
CurrencyBookgetCurrencies in interface CurrencyBookpublic Currency getCurrency(int code)
CurrencyBookgetCurrency in interface CurrencyBookcode - The ISO 4217 three-digit currency codepublic Currency getCurrency(String iso4217code, int precision)
CurrencyBookgetCurrency in interface CurrencyBookiso4217code - The ISO 4217 code of the currencyprecision - The minimum precision of the currencypublic Currency getCurrency(String code)
CurrencyBookgetCurrency in interface CurrencyBookcode - The code of the currencypublic void addCurrency(Currency currency)
CurrencyBookaddCurrency in interface CurrencyBookcurrency - The currency to be addedpublic static PropertyCurrencyBook createDefaultInstance()