public final class MoneyCurrency extends Object implements javax.money.CurrencyUnit, Serializable, Comparable<javax.money.CurrencyUnit>
CurrencyUnit
interface
using the JDK's Currency
.Modifier and Type | Class and Description |
---|---|
static class |
MoneyCurrency.Builder
Platform RI: Builder class that supports building complex instances of
MoneyCurrency . |
Modifier and Type | Field and Description |
---|---|
static String |
ISO_NAMESPACE |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(javax.money.CurrencyUnit currency) |
boolean |
equals(Object obj) |
static MoneyCurrency |
from(javax.money.CurrencyUnit currency) |
int |
getCashRounding()
Get the rounding steps in minor units for when using a cash amount of
this currency.
|
String |
getCurrencyCode() |
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() |
static boolean |
isAvailable(String code) |
static boolean |
isJavaCurrency(String code) |
static MoneyCurrency |
of(Currency currency)
Access a new instance based on
Currency . |
static MoneyCurrency |
of(String currencyCode)
Access a new instance based on the ISO currency code.
|
String |
toString()
Returns
getCurrencyCode() |
public static final String ISO_NAMESPACE
public static MoneyCurrency of(Currency currency)
Currency
.currency
- the currency unit not null.public static MoneyCurrency of(String currencyCode)
Currency
when passed to
Currency.getInstance(String)
.namespace
- the target namespace.currencyCode
- the ISO currency code, not null.MonetaryCurrency
instance.IllegalArgumentException
- if no such currency exists.public String getCurrencyCode()
getCurrencyCode
in interface javax.money.CurrencyUnit
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 within its namespace.
This method matches the API of
#getNamespace()
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
public int getCashRounding()
1.00, 1.05, 1.10
etc. The cash
rounding consequently extends the default fraction units for certain
currencies.public int compareTo(javax.money.CurrencyUnit currency)
compareTo
in interface Comparable<javax.money.CurrencyUnit>
public String toString()
getCurrencyCode()
toString
in class Object
Object.toString()
public static MoneyCurrency from(javax.money.CurrencyUnit currency)
public static boolean isJavaCurrency(String code)
public static boolean isAvailable(String code)
Copyright © 2012–2013 JSR 354 - Expert Group. All rights reserved.