public class Currency
extends java.lang.Object
implements java.io.Serializable
Java class represents an ISO defined or user defined currency
(such as free mileage).| Constructor and Description |
|---|
Currency(boolean ISOCurrency,
java.lang.String alphaCode,
int numericCode,
java.lang.String symbol,
java.lang.String fractionSymbol,
java.lang.String name,
java.lang.String fractionName,
int ratioOfFraction,
int smallestUnitAsFraction)
Deprecated.
|
Currency(boolean ISOCurrency,
java.lang.String alphaCode,
int numericCode,
java.lang.String symbol,
java.lang.String fractionSymbol,
java.lang.String name,
java.lang.String fractionName,
int ratioOfFraction,
int smallestUnitAsFraction,
boolean EMUCurrency,
java.math.BigDecimal euroConversionRate)
Deprecated.
|
Currency(java.lang.String code,
int precision,
java.lang.String ISOCode,
java.lang.String name)
Creates a new currency.
|
Currency(java.lang.String code,
int precision,
java.lang.String ISOCode,
java.lang.String name,
int numericCode,
int ratioOfFraction,
int smallestUnitAsFraction)
Creates a new currency; It is an ISO 4217 currency if
code is equal to ISOCode. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkCompatibility(Currency anotherCurrency)
Returns true if anotherCurrency is compatible with this currency, false otherwise.
|
boolean |
equals(java.lang.Object anotherCurrency)
Returns
true if anotherCurrency is a the same
currency as this, false otherwise. |
java.lang.String |
getAlphaCode()
Deprecated.
Returns the code of the currency.
|
static CurrencyBook |
getBook()
Returns the book of currencies that is used to
match ISO currency code and currency objects.
|
java.lang.String |
getCode()
Returns the unique code of the currency.
|
java.math.BigDecimal |
getEuroConversionRate()
Deprecated.
conversion rate is unknown returns BigDecimal.ZERO
|
java.lang.String |
getFractionName()
Deprecated.
Fraction name is unknown returns null
|
java.lang.String |
getFractionSymbol()
Deprecated.
Fraction symbol is unknown returns null
|
java.lang.String |
getISOCode()
Returns the ISO 4217 code of the currency.
|
java.lang.String |
getName()
Returns the name for this currency in the
language of the country where this currency
is used
(e.g.: US Dollar for USD, Euro for EUR).
|
int |
getNumericCode()
Returns the ISO 4217 three-digit code, or a user-defined
numeric code for a user-defined currency;
It is equal to 0 if it is not an ISO currency.
|
int |
getPrecision()
Returns the number of significative digits for
the computations of money amounts in this currency.
|
int |
getRatioOfFraction()
Returns the ratio of the fraction to the
whole (e.g.: 100 for USD);
It is equal to 0 if it is not an ISO currency
|
int |
getSmallestUnitAsFraction()
Returns the smallest multiples of sub-unit
in use for scriptural payment (e.g.: 1 for USD,
100 for BEF).
|
java.lang.String |
getSymbol()
Deprecated.
Symbol is unknown returns null
|
int |
hashCode()
Returns a hash code for this object.
|
boolean |
isEMUCurrency()
Deprecated.
returns false
|
boolean |
isISOCurrency()
Returns true if this is an ISO 4217 defined currency,
false if this represents a user defined currency.
|
static void |
setBook(CurrencyBook book)
Sets the book of currencies that is used to
match ISO currency code and currency objects.
|
java.lang.String |
toString()
Gives a string representation of the currency
(its ISO 4217 code if it is an ISO currency).
|
public Currency(java.lang.String code,
int precision,
java.lang.String ISOCode,
java.lang.String name,
int numericCode,
int ratioOfFraction,
int smallestUnitAsFraction)
code is equal to ISOCode.code - The unique code of the currency (mandatory, throws an IllegalArgumentException if the code is null or empty).precision - The precision of this currency (mandatory, throws an IllegalArgumentException if the precision is lower than 0).ISOCode - The ISO 4217 code for this currency (optional)name - The name of the currency (optional)numericCode - The numeric code for this currencyratioOfFraction - The ratio of the fraction to the wholesmallestUnitAsFraction - The smallest unit used in scriptural payment for this currencypublic Currency(java.lang.String code,
int precision,
java.lang.String ISOCode,
java.lang.String name)
code - The unique code of the currency (mandatory, throws an IllegalArgumentException if the code is null or empty).precision - The precision of this currency (mandatory, throws an IllegalArgumentException if the precision is lower than 0).ISOCode - The ISO 4217 code for this currency (optional)name - The name of the currency (optional)@Deprecated
public Currency(boolean ISOCurrency,
java.lang.String alphaCode,
int numericCode,
java.lang.String symbol,
java.lang.String fractionSymbol,
java.lang.String name,
java.lang.String fractionName,
int ratioOfFraction,
int smallestUnitAsFraction,
boolean EMUCurrency,
java.math.BigDecimal euroConversionRate)
ISOCurrency - true if it is an ISO 4217 defined currencyalphaCode - The alphabetic code of this currencynumericCode - The numeric code for this currencysymbol - The symbol for this currencyfractionSymbol - The symbol for the fraction of this currencyratioOfFraction - The ratio of the fraction to the wholename - The name of the currencyfractionName - The name of the fractionsmallestUnitAsFraction - The smallest unit used in scriptural payment
for this currencyEMUCurrency - true if the currency is an European
Monetary UniteuroConversionRate - The rate for conversion into euro
(only if the currency is an EMU).@Deprecated
public Currency(boolean ISOCurrency,
java.lang.String alphaCode,
int numericCode,
java.lang.String symbol,
java.lang.String fractionSymbol,
java.lang.String name,
java.lang.String fractionName,
int ratioOfFraction,
int smallestUnitAsFraction)
ISOCurrency - true if it is an ISO 4217 defined currencyalphaCode - the alphabetic code of this currencynumericCode - the numeric code for this currencysymbol - the symbol for this currencyfractionSymbol - the symbol for the fraction of this currencyname - the name of the currencyfractionName - The fractionNameratioOfFraction - The ratio of the fraction to the wholesmallestUnitAsFraction - The smallest unit used in scriptural payment for this currencypublic boolean equals(java.lang.Object anotherCurrency)
true if anotherCurrency is a the same
currency as this, false otherwise.equals in class java.lang.ObjectanotherCurrency - The currency to be compared to this currencytrue if currencies are equals, false otherwisepublic boolean checkCompatibility(Currency anotherCurrency)
anotherCurrency - The currency to which this currency must be compared totrue if the ISO code of currencies are equals (or if the currency codes are equals in case of ISO codes are null), false otherwise.public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isISOCurrency()
@Deprecated public java.lang.String getAlphaCode()
public int getNumericCode()
isISOCurrency()@Deprecated public java.lang.String getSymbol()
@Deprecated public java.lang.String getFractionSymbol()
public java.lang.String getName()
@Deprecated public java.lang.String getFractionName()
public int getRatioOfFraction()
public int getSmallestUnitAsFraction()
(Note: This is different from the smallest coin in cirulation). It is equal to 0 if it is not an ISO currency.
@Deprecated public boolean isEMUCurrency()
true if this currency is a currency of
a country member of the EMU.@Deprecated public java.math.BigDecimal getEuroConversionRate()
public int getPrecision()
public java.lang.String getCode()
public java.lang.String getISOCode()
public static CurrencyBook getBook()
public static void setBook(CurrencyBook book)
book - The book of currencies