Enum Class CurrencyCode
- All Implemented Interfaces:
Serializable,Comparable<CurrencyCode>,Constable
ISO 4217 currency codes with a representative
Locale for formatting.
Each constant holds its ISO code and a locale that provides appropriate
grouping, decimal separators, and symbol placement when used with
NumberFormat.getCurrencyInstance(Locale).
- API Note:
- This enum is immutable and thread-safe. The lookup map is
unmodifiable and built once in
<clinit>.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<CurrencyCode>Looks up a currency by its ISO 4217 code.getCode()Returns the ISO 4217 code.Returns the representative locale used for formatting this currency.Returns the correspondingCurrencyinstance.static CurrencyCodeReturns the enum constant of this class with the specified name.static CurrencyCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AED
-
AFN
-
ALL
-
AMD
-
ANG
-
AOA
-
ARS
-
AUD
-
AWG
-
AZN
-
BAM
-
BBD
-
BDT
-
BGN
-
BHD
-
BIF
-
BMD
-
BND
-
BOB
-
BRL
-
BSD
-
BTN
-
BWP
-
BYN
-
BZD
-
CAD
-
CDF
-
CHF
-
CLP
-
CNY
-
COP
-
CRC
-
CUP
-
CVE
-
CZK
-
DJF
-
DKK
-
DOP
-
DZD
-
EGP
-
ERN
-
ETB
-
EUR
-
FJD
-
FKP
-
GBP
-
GEL
-
GGP
-
GHS
-
GIP
-
GMD
-
GNF
-
GTQ
-
GYD
-
HKD
-
HNL
-
HTG
-
HUF
-
IDR
-
ILS
-
IMP
-
INR
-
IQD
-
IRR
-
ISK
-
JEP
-
JMD
-
JOD
-
JPY
-
KES
-
KGS
-
KHR
-
KMF
-
KRW
-
KWD
-
KYD
-
KZT
-
LAK
-
LBP
-
LKR
-
LRD
-
LSL
-
LYD
-
MAD
-
MDL
-
MGA
-
MKD
-
MMK
-
MNT
-
MOP
-
MRU
-
MUR
-
MVR
-
MWK
-
MXN
-
MYR
-
MZN
-
NAD
-
NGN
-
NIO
-
NOK
-
NPR
-
NZD
-
OMR
-
PAB
-
PEN
-
PGK
-
PHP
-
PKR
-
PLN
-
PYG
-
QAR
-
RON
-
RSD
-
RUB
-
RWF
-
SAR
-
SBD
-
SCR
-
SDG
-
SEK
-
SGD
-
SHP
-
SLE
-
SOS
-
SRD
-
SSP
-
STN
-
SVC
-
SYP
-
SZL
-
THB
-
TJS
-
TMT
-
TND
-
TOP
-
TRY
-
TTD
-
TWD
-
TZS
-
UAH
-
UGX
-
USD
-
UYU
-
UZS
-
VES
-
VND
-
VUV
-
WST
-
XAF
-
XAG
-
XAU
-
XCD
-
XCG
-
XOF
-
XPD
-
XPF
-
XPT
-
YER
-
ZAR
-
ZMW
-
ZWG
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
fromCode
Looks up a currency by its ISO 4217 code.The lookup is case-insensitive and trims surrounding whitespace.
- Parameters:
code- the ISO 4217 code, e.g."USD"or"eur"; may benull- Returns:
- an
Optionalcontaining the matching constant, or an emptyOptionalifcodeisnull, blank, or unknown
-
getCode
Returns the ISO 4217 code.- Returns:
- the three-letter code, never
null
-
getLocale
Returns the representative locale used for formatting this currency.The locale determines grouping separators, decimal separators, and symbol placement when used with
NumberFormat.- Returns:
- the locale, never
null
-
toCurrency
Returns the correspondingCurrencyinstance.- Returns:
- the JDK currency instance
- Throws:
IllegalArgumentException- if the code is not supported byCurrency.getInstance(String)(e.g.GGP,IMP, precious metals likeXAU)
-