public final class BuildableCurrencyUnit
extends java.lang.Object
implements javax.money.CurrencyUnit, java.lang.Comparable<javax.money.CurrencyUnit>
CurrencyUnit that allows to create new instances using a fluent API.
Instances created also can be added to the ConfigurableCurrencyUnitProvider
singleton, which publishes the instances, so they are visible from the MonetaryCurrencies
singleton.| Modifier and Type | Class and Description |
|---|---|
static class |
BuildableCurrencyUnit.Builder
Builder for constructing new instances o
BuildableCurrencyUnit using a fluent
API. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(javax.money.CurrencyUnit o) |
boolean |
equals(java.lang.Object obj) |
java.lang.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. within the ISO-4217 name space, this equals
to the ISO numeric code.
|
int |
hashCode() |
java.lang.String |
toString() |
public int compareTo(javax.money.CurrencyUnit o)
compareTo in interface java.lang.Comparable<javax.money.CurrencyUnit>public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String getCurrencyCode()
javax.money.CurrencyUnit
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.CurrencyUnitnull. 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 the fact that
the currency codes must be unique.public int getDefaultFractionDigits()
javax.money.CurrencyUnitDifferent 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 Currency.
getDefaultFractionDigits in interface javax.money.CurrencyUnitpublic int getNumericCode()
javax.money.CurrencyUnitThe 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 Currency.
getNumericCode in interface javax.money.CurrencyUnitpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object