public class Currency
extends java.lang.Object
| Constructor and Description |
|---|
Currency(java.lang.String name,
java.lang.String plural,
java.lang.String minor,
java.lang.String minorPlural,
java.lang.String sign)
Initialize a currency
|
Currency(java.lang.String name,
java.lang.String plural,
java.lang.String minor,
java.lang.String minorPlural,
java.lang.String sign,
boolean status) |
Currency(java.lang.String name,
java.lang.String plural,
java.lang.String minor,
java.lang.String minorPlural,
java.lang.String sign,
boolean status,
boolean bankCurrency) |
| Modifier and Type | Method and Description |
|---|---|
double |
getExchangeRate(Currency otherCurrency)
Returns the exchange rate between 2 currency.
|
java.lang.String |
getMinor()
Get the currency minor name
|
java.lang.String |
getMinorPlural()
Get the currency minor name in plural
|
java.lang.String |
getName()
Get the currency name
|
java.lang.String |
getPlural()
Get the currency name in plural
|
java.lang.String |
getSign()
Retrieve the sign of the currency (Example $ for Dollars)
|
boolean |
getStatus() |
boolean |
isPrimaryBankCurrency() |
protected void |
setBankCurrency(boolean bankCurrency) |
protected void |
setDefault(boolean status)
Set the default flag to true.
|
void |
setExchangeRate(Currency otherCurrency,
double amount)
Set the exchange rate between 2 currency
|
void |
setMinor(java.lang.String minor)
Set the currency minor name
|
void |
setMinorPlural(java.lang.String minorPlural)
Set the currency minor name in plural
|
void |
setName(java.lang.String name)
Set the currency name
|
void |
setPlural(java.lang.String plural)
Set the currency name in plural
|
void |
setSign(java.lang.String sign)
Sets the sign of the currency (Example $ for Dollars)
|
java.lang.String |
toString() |
public Currency(java.lang.String name,
java.lang.String plural,
java.lang.String minor,
java.lang.String minorPlural,
java.lang.String sign)
name - The name of the currencyplural - The plural name of the currencyminor - The minor name of the currencyminorPlural - The plural minor name of the currency.sign - The sign of the currency. (Example: $)public Currency(java.lang.String name,
java.lang.String plural,
java.lang.String minor,
java.lang.String minorPlural,
java.lang.String sign,
boolean status)
public Currency(java.lang.String name,
java.lang.String plural,
java.lang.String minor,
java.lang.String minorPlural,
java.lang.String sign,
boolean status,
boolean bankCurrency)
public java.lang.String getName()
public void setName(java.lang.String name)
name - The currency name to set to.public java.lang.String getPlural()
public void setPlural(java.lang.String plural)
plural - The currency name in plural to set to.public java.lang.String getMinor()
public void setMinor(java.lang.String minor)
minor - The currency minor name to set topublic java.lang.String getMinorPlural()
public void setMinorPlural(java.lang.String minorPlural)
minorPlural - The currency minor name in plural to set topublic void setSign(java.lang.String sign)
sign - The Sign of the Currency.public java.lang.String getSign()
public double getExchangeRate(Currency otherCurrency) throws NoExchangeRate
otherCurrency - The other currency to exchange toNoExchangeRate - If there's no exchange rate between the 2 currencies.public void setExchangeRate(Currency otherCurrency, double amount)
otherCurrency - The other currencyamount - THe exchange rate.protected void setDefault(boolean status)
status - If this currency is the default one or notpublic boolean getStatus()
public boolean isPrimaryBankCurrency()
protected void setBankCurrency(boolean bankCurrency)
public java.lang.String toString()
toString in class java.lang.Object