public final class JDKCurrencyAdapter extends Object implements javax.money.CurrencyUnit, Serializable, Comparable<javax.money.CurrencyUnit>
CurrencyUnit
based on the using the JDK's
Currency
.Modifier and Type | Method and Description |
---|---|
int |
compareTo(javax.money.CurrencyUnit currency)
Compares two instances, based on
getCurrencyCode() . |
boolean |
equals(Object obj) |
javax.money.CurrencyContext |
getContext() |
String |
getCurrencyCode()
Gets the unique currency code, the effective code depends on the
currency.
|
int |
getDefaultFractionDigits()
Gets the number of fractional digits typically used by this currency.
|
int |
getNumericCode()
Gets a numeric currency code.
|
int |
hashCode() |
String |
toString()
Returns
getCurrencyCode() |
public String getCurrencyCode()
Since each currency is identified by this code, the currency code is
required to be defined for every CurrencyUnit
and not
null
or empty.
For ISO codes the 3-letter ISO code should be returned. For non ISO currencies no constraints are defined.
getCurrencyCode
in interface javax.money.CurrencyUnit
null
. For ISO-4217 this this
will be the three letter ISO-4217 code. However, alternate
currencies can have different codes. Also there is no constraint
about the formatting of alternate codes, despite they fact that
the currency codes must be unique.CurrencyUnit.getCurrencyCode()
public int getNumericCode()
The numeric code is an optional alternative to the standard currency code. If defined, the numeric code is required to be unique.
This method matches the API of
getNumericCode
in interface javax.money.CurrencyUnit
CurrencyUnit.getNumericCode()
public int getDefaultFractionDigits()
Different currencies have different numbers of fractional digits by default. * For example, 'GBP' has 2 fractional digits, but 'JPY' has zero. * virtual currencies or those with no applicable fractional are indicated by -1. *
This method matches the API of
getDefaultFractionDigits
in interface javax.money.CurrencyUnit
public javax.money.CurrencyContext getContext()
getContext
in interface javax.money.CurrencyUnit
public int compareTo(javax.money.CurrencyUnit currency)
getCurrencyCode()
.compareTo
in interface Comparable<javax.money.CurrencyUnit>
currency
- The instance to be compared with.Comparable.compareTo(java.lang.Object)
public String toString()
getCurrencyCode()
toString
in class Object
Object.toString()
Copyright © 2012-2015 JavaMoney. All Rights Reserved.