|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mov.util.Currency
public class Currency
An immutaable representation of Currency. This class represents a currency, such as the Australian Dollar or the British Pound, rather than an acutal amount of money. We use our own representation because the Java API's Currency class has no way of returning a NumberFormat object. So we could not simply pass a Currency object to our Money object and have the Money object be able to print properly. We would have to pass both the locale and the currency around, which is heavy handed.
Money
Constructor Summary | |
---|---|
Currency(java.util.Locale locale)
Create an instance of the currency associated with the given locale. |
|
Currency(java.lang.String currencyCode)
Create an an instance of the currency using the currency described by the given ISO 4217 currency code. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Create and return a compare of this currency. |
int |
compareTo(java.lang.Object object)
Compare this currency to the given object. |
boolean |
equals(java.lang.Object object)
Compare this currency to the given object. |
static java.util.List |
getAvailableCurrencies()
Return a list of all the available currencies. |
java.lang.String |
getCurrencyCode()
Return the ISO 4217 currency code of this currency. |
static Currency |
getDefaultCurrency()
Return the currency associated with the default locale. |
int |
getDefaultFractionDigits()
Return the number of fraction digits used to display this currency. |
java.text.NumberFormat |
getNumberFormat()
Return the number format which can be used to form a number into the appropriate locale representation of this currency. |
java.lang.String |
toString()
Return a string representation of this currency. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Currency(java.util.Locale locale)
locale
- use the currency associated with this localepublic Currency(java.lang.String currencyCode) throws UnknownCurrencyCodeException
currencyCode
- the ISO 4217 currency code (3 characters).
UnknownCurrencyCodeException
- if the currency code is not known.Method Detail |
---|
public static java.util.List getAvailableCurrencies()
public static Currency getDefaultCurrency()
public java.lang.String getCurrencyCode()
public java.lang.String toString()
toString
in class java.lang.Object
public int getDefaultFractionDigits()
public java.text.NumberFormat getNumberFormat()
public int compareTo(java.lang.Object object)
ClassCastException
. Currencies
are ordered alphabetically by their ISO 4217 currency codes.
compareTo
in interface java.lang.Comparable
object
- currency object to be compared
java.lang.ClassCastException
- if the argument is not a Currency
.public boolean equals(java.lang.Object object)
ClassCastException
.
equals
in class java.lang.Object
object
- currency object to be compared
true
if the currencies are the same; false
otherwise.
java.lang.ClassCastException
- if the argument is not a Currency
.public java.lang.Object clone()
clone
in class java.lang.Object
|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |