com.neovisionaries.i18n.CurrencyCode Maven / Gradle / Ivy
/*
* Copyright (C) 2014,2016 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.neovisionaries.i18n;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Currency;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
* Currency code (ISO 4217).
*
*
* The initial entries in this enum was created based on
* the official currency & funds code list (ISO 4217) of
* January 1, 2014.
*
*
* @since 1.9
*
* @see The official currency & funds code list
*
* @see ISO 4217
*
* @author Takahiko Kawasaki
*/
public enum CurrencyCode
{
/**
* Undefined.
*
*
* This is not an official ISO 4217 code.
*
*
* @since 1.14
* @see #XXX XXX: 999 No currency
*/
UNDEFINED("Undefined", -1, -1),
/**
* UAE Dirham
* [numeric code = 784, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AE AE}: UNITED ARAB EMIRATES
*
*/
AED("UAE Dirham", 784, 2, CountryCode.AE),
/**
* Afghani
* [numeric code = 971, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AF AF}: AFGHANISTAN
*
*/
AFN("Afghani", 971, 2, CountryCode.AF),
/**
* Lek
* [numeric code = 8, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AL AL}: ALBANIA
*
*/
ALL("Lek", 8, 2, CountryCode.AL),
/**
* Armenian Dram
* [numeric code = 51, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AM AM}: ARMENIA
*
*/
AMD("Armenian Dram", 51, 2, CountryCode.AM),
/**
* Netherlands Antillean Guilder
* [numeric code = 532, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CW CW}: CURAÇAO
*
- {@link CountryCode#SX SX}: SINT MAARTEN (DUTCH PART)
*
*/
ANG("Netherlands Antillean Guilder", 532, 2, CountryCode.CW, CountryCode.SX),
/**
* Kwanza
* [numeric code = 973, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AO AO}: ANGOLA
*
*/
AOA("Kwanza", 973, 2, CountryCode.AO),
/**
* Argentine Peso
* [numeric code = 32, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AR AR}: ARGENTINA
*
*/
ARS("Argentine Peso", 32, 2, CountryCode.AR),
/**
* Australian Dollar
* [numeric code = 36, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AU AU}: AUSTRALIA
*
- {@link CountryCode#CC CC}: COCOS (KEELING) ISLANDS
*
- {@link CountryCode#CX CX}: CHRISTMAS ISLAND
*
- {@link CountryCode#HM HM}: HEARD ISLAND AND McDONALD ISLANDS
*
- {@link CountryCode#KI KI}: KIRIBATI
*
- {@link CountryCode#NF NF}: NORFOLK ISLAND
*
- {@link CountryCode#NR NR}: NAURU
*
- {@link CountryCode#TV TV}: TUVALU
*
*/
AUD("Australian Dollar", 36, 2,
CountryCode.AU, CountryCode.CC, CountryCode.CX, CountryCode.HM,
CountryCode.KI, CountryCode.NF, CountryCode.NR, CountryCode.TV),
/**
* Aruban Florin
* [numeric code = 533, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AW AW}: ARUBA
*
*/
AWG("Aruban Florin", 533, 2, CountryCode.AW),
/**
* Azerbaijanian Manat
* [numeric code = 944, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AZ AZ}: AZERBAIJAN
*
*/
AZN("Azerbaijanian Manat", 944, 2, CountryCode.AZ),
/**
* Convertible Mark
* [numeric code = 977, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BA BA}: BOSNIA AND HERZEGOVINA
*
*/
BAM("Convertible Mark", 977, 2, CountryCode.BA),
/**
* Barbados Dollar
* [numeric code = 52, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BB BB}: BARBADOS
*
*/
BBD("Barbados Dollar", 52, 2, CountryCode.BB),
/**
* Taka
* [numeric code = 50, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BD BD}: BANGLADESH
*
*/
BDT("Taka", 50, 2, CountryCode.BD),
/**
* Bulgarian Lev
* [numeric code = 975, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BG BG}: BULGARIA
*
*/
BGN("Bulgarian Lev", 975, 2, CountryCode.BG),
/**
* Bahraini Dinar
* [numeric code = 48, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#BH BH}: BAHRAIN
*
*/
BHD("Bahraini Dinar", 48, 3, CountryCode.BH),
/**
* Burundi Franc
* [numeric code = 108, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#BI BI}: BURUNDI
*
*/
BIF("Burundi Franc", 108, 0, CountryCode.BI),
/**
* Bermudian Dollar
* [numeric code = 60, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BM BM}: BERMUDA
*
*/
BMD("Bermudian Dollar", 60, 2, CountryCode.BM),
/**
* Brunei Dollar
* [numeric code = 96, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BN BN}: BRUNEI DARUSSALAM
*
*/
BND("Brunei Dollar", 96, 2, CountryCode.BN),
/**
* Boliviano
* [numeric code = 68, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BO BO}: BOLIVIA, PLURINATIONAL STATE OF
*
*/
BOB("Boliviano", 68, 2, CountryCode.BO),
/**
* Mvdol
* [numeric code = 984, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#BO BO}: BOLIVIA, PLURINATIONAL STATE OF
*
*/
BOV("Mvdol", 984, 2, CountryCode.BO)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Brazilian Real
* [numeric code = 986, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BR BR}: BRAZIL
*
*/
BRL("Brazilian Real", 986, 2, CountryCode.BR),
/**
* Bahamian Dollar
* [numeric code = 44, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BS BS}: BAHAMAS
*
*/
BSD("Bahamian Dollar", 44, 2, CountryCode.BS),
/**
* Ngultrum
* [numeric code = 64, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BT BT}: BHUTAN
*
*/
BTN("Ngultrum", 64, 2, CountryCode.BT),
/**
* Pula
* [numeric code = 72, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BW BW}: BOTSWANA
*
*/
BWP("Pula", 72, 2, CountryCode.BW),
/**
* Belarusian Ruble
* [numeric code = 933, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BY BY}: BELARUS
*
*
*
* This currency code was added by ISO 4217 AMENDMENT NUMBER 161 (18 December 2015). Effective from 1 July 2016.
*
*
* @see ISO 4217 AMENDMENT NUMBER 161
*
* @see #BYR
*
* @since 1.19
*/
BYN("Belarusian Ruble", 933, 2, CountryCode.BY),
/**
* Belarusian Ruble
* [numeric code = 974, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#BY BY}: BELARUS
*
*
* @see #BYN
*/
BYR("Belarusian Ruble", 974, 0, CountryCode.BY),
/**
* Belize Dollar
* [numeric code = 84, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BZ BZ}: BELIZE
*
*/
BZD("Belize Dollar", 84, 2, CountryCode.BZ),
/**
* Canadian Dollar
* [numeric code = 124, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CA CA}: CANADA
*
*/
CAD("Canadian Dollar", 124, 2, CountryCode.CA),
/**
* Congolese Franc
* [numeric code = 976, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CD CD}: CONGO, THE DEMOCRATIC REPUBLIC OF
*
*/
CDF("Congolese Franc", 976, 2, CountryCode.CD),
/**
* WIR Euro
* [numeric code = 947, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#CH CH}: SWITZERLAND
*
*/
CHE("WIR Euro", 947, 2, CountryCode.CH)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Swiss Franc
* [numeric code = 756, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CH CH}: SWITZERLAND
*
- {@link CountryCode#LI LI}: LIECHTENSTEIN
*
*/
CHF("Swiss Franc", 756, 2, CountryCode.CH, CountryCode.LI),
/**
* WIR Franc
* [numeric code = 948, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#CH CH}: SWITZERLAND
*
*/
CHW("WIR Franc", 948, 2, CountryCode.CH)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Unidad de Fomento
* [numeric code = 990, minor unit = 0, fund]
*
* Used by:
*
* - {@link CountryCode#CL CL}: CHILE
*
*/
CLF("Unidad de Fomento", 990, 0, CountryCode.CL)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Chilean Peso
* [numeric code = 152, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#CL CL}: CHILE
*
*/
CLP("Chilean Peso", 152, 0, CountryCode.CL),
/**
* Yuan Renminbi
* [numeric code = 156, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CN CN}: CHINA
*
*/
CNY("Yuan Renminbi", 156, 2, CountryCode.CN),
/**
* Colombian Peso
* [numeric code = 170, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CO CO}: COLOMBIA
*
*/
COP("Colombian Peso", 170, 2, CountryCode.CO),
/**
* Unidad de Valor Real
* [numeric code = 970, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#CO CO}: COLOMBIA
*
*/
COU("Unidad de Valor Real", 970, 2, CountryCode.CO)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Costa Rican Colon
* [numeric code = 188, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CR CR}: COSTA RICA
*
*/
CRC("Costa Rican Colon", 188, 2, CountryCode.CR),
/**
* Peso Convertible
* [numeric code = 931, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CU CU}: CUBA
*
*/
CUC("Peso Convertible", 931, 2, CountryCode.CU),
/**
* Cuban Peso
* [numeric code = 192, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CU CU}: CUBA
*
*/
CUP("Cuban Peso", 192, 2, CountryCode.CU),
/**
* Cape Verde Escudo
* [numeric code = 132, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CV CV}: CAPE VERDE
*
*/
CVE("Cape Verde Escudo", 132, 2, CountryCode.CV),
/**
* Czech Koruna
* [numeric code = 203, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CZ CZ}: CZECH REPUBLIC
*
*/
CZK("Czech Koruna", 203, 2, CountryCode.CZ),
/**
* Djibouti Franc
* [numeric code = 262, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#DJ DJ}: DJIBOUTI
*
*/
DJF("Djibouti Franc", 262, 0, CountryCode.DJ),
/**
* Danish Krone
* [numeric code = 208, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#DK DK}: DENMARK
*
- {@link CountryCode#FO FO}: FAROE ISLANDS
*
- {@link CountryCode#GL GL}: GREENLAND
*
*/
DKK("Danish Krone", 208, 2, CountryCode.DK, CountryCode.FO, CountryCode.GL),
/**
* Dominican Peso
* [numeric code = 214, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#DO DO}: DOMINICAN REPUBLIC
*
*/
DOP("Dominican Peso", 214, 2, CountryCode.DO),
/**
* Algerian Dinar
* [numeric code = 12, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#DZ DZ}: ALGERIA
*
*/
DZD("Algerian Dinar", 12, 2, CountryCode.DZ),
/**
* Egyptian Pound
* [numeric code = 818, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#EG EG}: EGYPT
*
*/
EGP("Egyptian Pound", 818, 2, CountryCode.EG),
/**
* Nakfa
* [numeric code = 232, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#ER ER}: ERITREA
*
*/
ERN("Nakfa", 232, 2, CountryCode.ER),
/**
* Ethiopian Birr
* [numeric code = 230, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#ET ET}: ETHIOPIA
*
*/
ETB("Ethiopian Birr", 230, 2, CountryCode.ET),
/**
* Euro
* [numeric code = 978, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AD AD}: ANDORRA
*
- {@link CountryCode#AT AT}: AUSTRIA
*
- {@link CountryCode#AX AX}: ÅLAND ISLANDS
*
- {@link CountryCode#BE BE}: BELGIUM
*
- {@link CountryCode#BL BL}: SAINT BARTHÉLEMY
*
- {@link CountryCode#CY CY}: CYPRUS
*
- {@link CountryCode#DE DE}: GERMANY
*
- {@link CountryCode#EE EE}: ESTONIA
*
- {@link CountryCode#ES ES}: SPAIN
*
- {@link CountryCode#EU EU}: EUROPEAN UNION
*
- {@link CountryCode#FI FI}: FINLAND
*
- {@link CountryCode#FR FR}: FRANCE
*
- {@link CountryCode#GF GF}: FRENCH GUIANA
*
- {@link CountryCode#GP GP}: GUADELOUPE
*
- {@link CountryCode#GR GR}: GREECE
*
- {@link CountryCode#IE IE}: IRELAND
*
- {@link CountryCode#IT IT}: ITALY
*
- {@link CountryCode#LU LU}: LUXEMBOURG
*
- {@link CountryCode#LV LV}: LATVIA
*
- {@link CountryCode#MC MC}: MONACO
*
- {@link CountryCode#ME ME}: MONTENEGRO
*
- {@link CountryCode#MF MF}: SAINT MARTIN (FRENCH PART)
*
- {@link CountryCode#MQ MQ}: MARTINIQUE
*
- {@link CountryCode#MT MT}: MALTA
*
- {@link CountryCode#NL NL}: NETHERLANDS
*
- {@link CountryCode#PM PM}: SAINT PIERRE AND MIQUELON
*
- {@link CountryCode#PT PT}: PORTUGAL
*
- {@link CountryCode#RE RE}: RÉUNION
*
- {@link CountryCode#SI SI}: SLOVENIA
*
- {@link CountryCode#SK SK}: SLOVAKIA
*
- {@link CountryCode#SM SM}: SAN MARINO
*
- {@link CountryCode#TF TF}: FRENCH SOUTHERN TERRITORIES
*
- {@link CountryCode#VA VA}: HOLY SEE (VATICAN CITY STATE)
*
- {@link CountryCode#XK XK}: KOSOVO, REPUBLIC OF
*
- {@link CountryCode#YT YT}: MAYOTTE
*
*/
EUR("Euro", 978, 2,
CountryCode.AD, CountryCode.AT, CountryCode.AX, CountryCode.BE,
CountryCode.BL, CountryCode.CY, CountryCode.DE, CountryCode.EE,
CountryCode.ES, CountryCode.EU, CountryCode.FI, CountryCode.FR,
CountryCode.GF, CountryCode.GP, CountryCode.GR, CountryCode.IE,
CountryCode.IT, CountryCode.LU, CountryCode.LV, CountryCode.MC,
CountryCode.ME, CountryCode.MF, CountryCode.MQ, CountryCode.MT,
CountryCode.NL, CountryCode.PM, CountryCode.PT, CountryCode.RE,
CountryCode.SI, CountryCode.SK, CountryCode.SM, CountryCode.TF,
CountryCode.VA, CountryCode.XK, CountryCode.YT),
/**
* Fiji Dollar
* [numeric code = 242, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#FJ FJ}: FIJI
*
*/
FJD("Fiji Dollar", 242, 2, CountryCode.FJ),
/**
* Falkland Islands Pound
* [numeric code = 238, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#FK FK}: FALKLAND ISLANDS (MALVINAS)
*
*/
FKP("Falkland Islands Pound", 238, 2, CountryCode.FK),
/**
* Pound Sterling
* [numeric code = 826, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GB GB}: UNITED KINGDOM
*
- {@link CountryCode#GG GG}: GUERNSEY
*
- {@link CountryCode#IM IM}: ISLE OF MAN
*
- {@link CountryCode#JE JE}: JERSEY
*
*/
GBP("Pound Sterling", 826, 2,
CountryCode.GB, CountryCode.GG, CountryCode.IM, CountryCode.JE),
/**
* Lari
* [numeric code = 981, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GE GE}: GEORGIA
*
*/
GEL("Lari", 981, 2, CountryCode.GE),
/**
* Ghana Cedi
* [numeric code = 936, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GH GH}: GHANA
*
*/
GHS("Ghana Cedi", 936, 2, CountryCode.GH),
/**
* Gibraltar Pound
* [numeric code = 292, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GI GI}: GIBRALTAR
*
*/
GIP("Gibraltar Pound", 292, 2, CountryCode.GI),
/**
* Dalasi
* [numeric code = 270, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GM GM}: GAMBIA
*
*/
GMD("Dalasi", 270, 2, CountryCode.GM),
/**
* Guinea Franc
* [numeric code = 324, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#GN GN}: GUINEA
*
*/
GNF("Guinea Franc", 324, 0, CountryCode.GN),
/**
* Quetzal
* [numeric code = 320, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GT GT}: GUATEMALA
*
*/
GTQ("Quetzal", 320, 2, CountryCode.GT),
/**
* Guyana Dollar
* [numeric code = 328, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#GY GY}: GUYANA
*
*/
GYD("Guyana Dollar", 328, 2, CountryCode.GY),
/**
* Hong Kong Dollar
* [numeric code = 344, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#HK HK}: HONG KONG
*
*/
HKD("Hong Kong Dollar", 344, 2, CountryCode.HK),
/**
* Lempira
* [numeric code = 340, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#HN HN}: HONDURAS
*
*/
HNL("Lempira", 340, 2, CountryCode.HN),
/**
* Croatian Kuna
* [numeric code = 191, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#HR HR}: CROATIA
*
*/
HRK("Croatian Kuna", 191, 2, CountryCode.HR),
/**
* Gourde
* [numeric code = 332, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#HT HT}: HAITI
*
*/
HTG("Gourde", 332, 2, CountryCode.HT),
/**
* Forint
* [numeric code = 348, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#HU HU}: HUNGARY
*
*/
HUF("Forint", 348, 2, CountryCode.HU),
/**
* Rupiah
* [numeric code = 360, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#ID ID}: INDONESIA
*
*/
IDR("Rupiah", 360, 2, CountryCode.ID),
/**
* New Israeli Sheqel
* [numeric code = 376, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#IL IL}: ISRAEL
*
*/
ILS("New Israeli Sheqel", 376, 2, CountryCode.IL),
/**
* Indian Rupee
* [numeric code = 356, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BT BT}: BHUTAN
*
- {@link CountryCode#IN IN}: INDIA
*
*/
INR("Indian Rupee", 356, 2, CountryCode.BT, CountryCode.IN),
/**
* Iraqi Dinar
* [numeric code = 368, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#IQ IQ}: IRAQ
*
*/
IQD("Iraqi Dinar", 368, 3, CountryCode.IQ),
/**
* Iranian Rial
* [numeric code = 364, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#IR IR}: IRAN, ISLAMIC REPUBLIC OF
*
*/
IRR("Iranian Rial", 364, 2, CountryCode.IR),
/**
* Iceland Krona
* [numeric code = 352, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#IS IS}: ICELAND
*
*/
ISK("Iceland Krona", 352, 0, CountryCode.IS),
/**
* Jamaican Dollar
* [numeric code = 388, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#JM JM}: JAMAICA
*
*/
JMD("Jamaican Dollar", 388, 2, CountryCode.JM),
/**
* Jordanian Dinar
* [numeric code = 400, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#JO JO}: JORDAN
*
*/
JOD("Jordanian Dinar", 400, 3, CountryCode.JO),
/**
* Yen
* [numeric code = 392, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#JP JP}: JAPAN
*
*/
JPY("Yen", 392, 0, CountryCode.JP),
/**
* Kenyan Shilling
* [numeric code = 404, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#KE KE}: KENYA
*
*/
KES("Kenyan Shilling", 404, 2, CountryCode.KE),
/**
* Som
* [numeric code = 417, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#KG KG}: KYRGYZSTAN
*
*/
KGS("Som", 417, 2, CountryCode.KG),
/**
* Riel
* [numeric code = 116, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#KH KH}: CAMBODIA
*
*/
KHR("Riel", 116, 2, CountryCode.KH),
/**
* Comoro Franc
* [numeric code = 174, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#KM KM}: COMOROS
*
*/
KMF("Comoro Franc", 174, 0, CountryCode.KM),
/**
* North Korean Won
* [numeric code = 408, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#KP KP}: KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
*
*/
KPW("North Korean Won", 408, 2, CountryCode.KP),
/**
* Won
* [numeric code = 410, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#KR KR}: KOREA, REPUBLIC OF
*
*/
KRW("Won", 410, 0, CountryCode.KR),
/**
* Kuwaiti Dinar
* [numeric code = 414, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#KW KW}: KUWAIT
*
*/
KWD("Kuwaiti Dinar", 414, 3, CountryCode.KW),
/**
* Cayman Islands Dollar
* [numeric code = 136, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#KY KY}: CAYMAN ISLANDS
*
*/
KYD("Cayman Islands Dollar", 136, 2, CountryCode.KY),
/**
* Tenge
* [numeric code = 398, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#KZ KZ}: KAZAKHSTAN
*
*/
KZT("Tenge", 398, 2, CountryCode.KZ),
/**
* Kip
* [numeric code = 418, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LA LA}: LAO PEOPLE'S DEMOCRATIC REPUBLIC
*
*/
LAK("Kip", 418, 2, CountryCode.LA),
/**
* Lebanese Pound
* [numeric code = 422, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LB LB}: LEBANON
*
*/
LBP("Lebanese Pound", 422, 2, CountryCode.LB),
/**
* Sri Lanka Rupee
* [numeric code = 144, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LK LK}: SRI LANKA
*
*/
LKR("Sri Lanka Rupee", 144, 2, CountryCode.LK),
/**
* Liberian Dollar
* [numeric code = 430, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LR LR}: LIBERIA
*
*/
LRD("Liberian Dollar", 430, 2, CountryCode.LR),
/**
* Loti
* [numeric code = 426, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LS LS}: LESOTHO
*
*/
LSL("Loti", 426, 2, CountryCode.LS),
/**
* Lithuanian Litas
* [numeric code = 440, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LT LT}: LITHUANIA
*
*/
LTL("Lithuanian Litas", 440, 2, CountryCode.LT),
/**
* Libyan Dinar
* [numeric code = 434, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#LY LY}: LIBYA
*
*/
LYD("Libyan Dinar", 434, 3, CountryCode.LY),
/**
* Moroccan Dirham
* [numeric code = 504, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#EH EH}: WESTERN SAHARA
*
- {@link CountryCode#MA MA}: MOROCCO
*
*/
MAD("Moroccan Dirham", 504, 2, CountryCode.EH, CountryCode.MA),
/**
* Moldovan Leu
* [numeric code = 498, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MD MD}: MOLDOVA, REPUBLIC OF
*
*/
MDL("Moldovan Leu", 498, 2, CountryCode.MD),
/**
* Malagasy Ariary
* [numeric code = 969, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MG MG}: MADAGASCAR
*
*/
MGA("Malagasy Ariary", 969, 2, CountryCode.MG),
/**
* Denar
* [numeric code = 807, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MK MK}: MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
*
*/
MKD("Denar", 807, 2, CountryCode.MK),
/**
* Kyat
* [numeric code = 104, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MM MM}: MYANMAR
*
*/
MMK("Kyat", 104, 2, CountryCode.MM),
/**
* Tugrik
* [numeric code = 496, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MN MN}: MONGOLIA
*
*/
MNT("Tugrik", 496, 2, CountryCode.MN),
/**
* Pataca
* [numeric code = 446, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MO MO}: MACAO
*
*/
MOP("Pataca", 446, 2, CountryCode.MO),
/**
* Ouguiya
* [numeric code = 478, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MR MR}: MAURITANIA
*
*/
MRO("Ouguiya", 478, 2, CountryCode.MR),
/**
* Mauritius Rupee
* [numeric code = 480, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MU MU}: MAURITIUS
*
*/
MUR("Mauritius Rupee", 480, 2, CountryCode.MU),
/**
* Rufiyaa
* [numeric code = 462, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MV MV}: MALDIVES
*
*/
MVR("Rufiyaa", 462, 2, CountryCode.MV),
/**
* Kwacha
* [numeric code = 454, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MW MW}: MALAWI
*
*/
MWK("Kwacha", 454, 2, CountryCode.MW),
/**
* Mexican Peso
* [numeric code = 484, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MX MX}: MEXICO
*
*/
MXN("Mexican Peso", 484, 2, CountryCode.MX),
/**
* Mexican Unidad de Inversion (UDI)
* [numeric code = 979, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#MX MX}: MEXICO
*
*/
MXV("Mexican Unidad de Inversion (UDI)", 979, 2, CountryCode.MX)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Malaysian Ringgit
* [numeric code = 458, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MY MY}: MALAYSIA
*
*/
MYR("Malaysian Ringgit", 458, 2, CountryCode.MY),
/**
* Mozambique Metical
* [numeric code = 943, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#MZ MZ}: MOZAMBIQUE
*
*/
MZN("Mozambique Metical", 943, 2, CountryCode.MZ),
/**
* Namibia Dollar
* [numeric code = 516, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#NA NA}: NAMIBIA
*
*/
NAD("Namibia Dollar", 516, 2, CountryCode.NA),
/**
* Naira
* [numeric code = 566, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#NG NG}: NIGERIA
*
*/
NGN("Naira", 566, 2, CountryCode.NG),
/**
* Cordoba Oro
* [numeric code = 558, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#NI NI}: NICARAGUA
*
*/
NIO("Cordoba Oro", 558, 2, CountryCode.NI),
/**
* Norwegian Krone
* [numeric code = 578, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#BV BV}: BOUVET ISLAND
*
- {@link CountryCode#NO NO}: NORWAY
*
- {@link CountryCode#SJ SJ}: SVALBARD AND JAN MAYEN
*
*/
NOK("Norwegian Krone", 578, 2, CountryCode.BV, CountryCode.NO, CountryCode.SJ),
/**
* Nepalese Rupee
* [numeric code = 524, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#NP NP}: NEPAL
*
*/
NPR("Nepalese Rupee", 524, 2, CountryCode.NP),
/**
* New Zealand Dollar
* [numeric code = 554, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#CK CK}: COOK ISLANDS
*
- {@link CountryCode#NU NU}: NIUE
*
- {@link CountryCode#NZ NZ}: NEW ZEALAND
*
- {@link CountryCode#PN PN}: PITCAIRN
*
- {@link CountryCode#TK TK}: TOKELAU
*
*/
NZD("New Zealand Dollar", 554, 2,
CountryCode.CK, CountryCode.NU, CountryCode.NZ, CountryCode.PN,
CountryCode.TK),
/**
* Rial Omani
* [numeric code = 512, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#OM OM}: OMAN
*
*/
OMR("Rial Omani", 512, 3, CountryCode.OM),
/**
* Balboa
* [numeric code = 590, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#PA PA}: PANAMA
*
*/
PAB("Balboa", 590, 2, CountryCode.PA),
/**
* Nuevo Sol
* [numeric code = 604, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#PE PE}: PERU
*
*/
PEN("Nuevo Sol", 604, 2, CountryCode.PE),
/**
* Kina
* [numeric code = 598, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#PG PG}: PAPUA NEW GUINEA
*
*/
PGK("Kina", 598, 2, CountryCode.PG),
/**
* Philippine Peso
* [numeric code = 608, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#PH PH}: PHILIPPINES
*
*/
PHP("Philippine Peso", 608, 2, CountryCode.PH),
/**
* Pakistan Rupee
* [numeric code = 586, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#PK PK}: PAKISTAN
*
*/
PKR("Pakistan Rupee", 586, 2, CountryCode.PK),
/**
* Zloty
* [numeric code = 985, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#PL PL}: POLAND
*
*/
PLN("Zloty", 985, 2, CountryCode.PL),
/**
* Guarani
* [numeric code = 600, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#PY PY}: PARAGUAY
*
*/
PYG("Guarani", 600, 0, CountryCode.PY),
/**
* Qatari Rial
* [numeric code = 634, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#QA QA}: QATAR
*
*/
QAR("Qatari Rial", 634, 2, CountryCode.QA),
/**
* New Romanian Leu
* [numeric code = 946, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#RO RO}: ROMANIA
*
*/
RON("New Romanian Leu", 946, 2, CountryCode.RO),
/**
* Serbian Dinar
* [numeric code = 941, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#RS RS}: SERBIA
*
*/
RSD("Serbian Dinar", 941, 2, CountryCode.RS),
/**
* Russian Ruble
* [numeric code = 643, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#RU RU}: RUSSIAN FEDERATION
*
*/
RUB("Russian Ruble", 643, 2, CountryCode.RU),
/**
* Rwanda Franc
* [numeric code = 646, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#RW RW}: RWANDA
*
*/
RWF("Rwanda Franc", 646, 0, CountryCode.RW),
/**
* Saudi Riyal
* [numeric code = 682, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SA SA}: SAUDI ARABIA
*
*/
SAR("Saudi Riyal", 682, 2, CountryCode.SA),
/**
* Solomon Islands Dollar
* [numeric code = 90, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SB SB}: SOLOMON ISLANDS
*
*/
SBD("Solomon Islands Dollar", 90, 2, CountryCode.SB),
/**
* Seychelles Rupee
* [numeric code = 690, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SC SC}: SEYCHELLES
*
*/
SCR("Seychelles Rupee", 690, 2, CountryCode.SC),
/**
* Sudanese Pound
* [numeric code = 938, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SD SD}: SUDAN
*
*/
SDG("Sudanese Pound", 938, 2, CountryCode.SD),
/**
* Swedish Krona
* [numeric code = 752, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SE SE}: SWEDEN
*
*/
SEK("Swedish Krona", 752, 2, CountryCode.SE),
/**
* Singapore Dollar
* [numeric code = 702, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SG SG}: SINGAPORE
*
*/
SGD("Singapore Dollar", 702, 2, CountryCode.SG),
/**
* Saint Helena Pound
* [numeric code = 654, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SH SH}: SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA
*
*/
SHP("Saint Helena Pound", 654, 2, CountryCode.SH),
/**
* Leone
* [numeric code = 694, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SL SL}: SIERRA LEONE
*
*/
SLL("Leone", 694, 2, CountryCode.SL),
/**
* Somali Shilling
* [numeric code = 706, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SO SO}: SOMALIA
*
*/
SOS("Somali Shilling", 706, 2, CountryCode.SO),
/**
* Surinam Dollar
* [numeric code = 968, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SR SR}: SURINAME
*
*/
SRD("Surinam Dollar", 968, 2, CountryCode.SR),
/**
* South Sudanese Pound
* [numeric code = 728, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SS SS}: SOUTH SUDAN
*
*/
SSP("South Sudanese Pound", 728, 2, CountryCode.SS),
/**
* Dobra
* [numeric code = 678, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#ST ST}: SAO TOME AND PRINCIPE
*
*/
STD("Dobra", 678, 2, CountryCode.ST),
/**
* El Salvador Colon
* [numeric code = 222, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SV SV}: EL SALVADOR
*
*/
SVC("El Salvador Colon", 222, 2, CountryCode.SV),
/**
* Syrian Pound
* [numeric code = 760, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SY SY}: SYRIAN ARAB REPUBLIC
*
*/
SYP("Syrian Pound", 760, 2, CountryCode.SY),
/**
* Lilangeni
* [numeric code = 748, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#SZ SZ}: SWAZILAND
*
*/
SZL("Lilangeni", 748, 2, CountryCode.SZ),
/**
* Baht
* [numeric code = 764, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TH TH}: THAILAND
*
*/
THB("Baht", 764, 2, CountryCode.TH),
/**
* Somoni
* [numeric code = 972, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TJ TJ}: TAJIKISTAN
*
*/
TJS("Somoni", 972, 2, CountryCode.TJ),
/**
* Turkmenistan New Manat
* [numeric code = 934, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TM TM}: TURKMENISTAN
*
*/
TMT("Turkmenistan New Manat", 934, 2, CountryCode.TM),
/**
* Tunisian Dinar
* [numeric code = 788, minor unit = 3]
*
* Used by:
*
* - {@link CountryCode#TN TN}: TUNISIA
*
*/
TND("Tunisian Dinar", 788, 3, CountryCode.TN),
/**
* Paʻanga
* [numeric code = 776, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TO TO}: TONGA
*
*/
TOP("Pa\u02BBanga", 776, 2, CountryCode.TO),
/**
* Turkish Lira
* [numeric code = 949, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TR TR}: TURKEY
*
*/
TRY("Turkish Lira", 949, 2, CountryCode.TR),
/**
* Trinidad and Tobago Dollar
* [numeric code = 780, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TT TT}: TRINIDAD AND TOBAGO
*
*/
TTD("Trinidad and Tobago Dollar", 780, 2, CountryCode.TT),
/**
* New Taiwan Dollar
* [numeric code = 901, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TW TW}: TAIWAN, PROVINCE OF CHINA
*
*/
TWD("New Taiwan Dollar", 901, 2, CountryCode.TW),
/**
* Tanzanian Shilling
* [numeric code = 834, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#TZ TZ}: TANZANIA, UNITED REPUBLIC OF
*
*/
TZS("Tanzanian Shilling", 834, 2, CountryCode.TZ),
/**
* Hryvnia
* [numeric code = 980, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#UA UA}: UKRAINE
*
*/
UAH("Hryvnia", 980, 2, CountryCode.UA),
/**
* Uganda Shilling
* [numeric code = 800, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#UG UG}: UGANDA
*
*/
UGX("Uganda Shilling", 800, 0, CountryCode.UG),
/**
* US Dollar
* [numeric code = 840, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AS AS}: AMERICAN SAMOA
*
- {@link CountryCode#BQ BQ}: BONAIRE, SINT EUSTATIUS AND SABA
*
- {@link CountryCode#EC EC}: ECUADOR
*
- {@link CountryCode#FM FM}: MICRONESIA, FEDERATED STATES OF
*
- {@link CountryCode#GU GU}: GUAM
*
- {@link CountryCode#HT HT}: HAITI
*
- {@link CountryCode#IO IO}: BRITISH INDIAN OCEAN TERRITORY
*
- {@link CountryCode#MH MH}: MARSHALL ISLANDS
*
- {@link CountryCode#MP MP}: NORTHERN MARIANA ISLANDS
*
- {@link CountryCode#PA PA}: PANAMA
*
- {@link CountryCode#PR PR}: PUERTO RICO
*
- {@link CountryCode#PW PW}: PALAU
*
- {@link CountryCode#SV SV}: EL SALVADOR
*
- {@link CountryCode#TC TC}: TURKS AND CAICOS ISLANDS
*
- {@link CountryCode#TL TL}: TIMOR-LESTE
*
- {@link CountryCode#UM UM}: UNITED STATES MINOR OUTLYING ISLANDS
*
- {@link CountryCode#US US}: UNITED STATES
*
- {@link CountryCode#VG VG}: VIRGIN ISLANDS (BRITISH)
*
- {@link CountryCode#VI VI}: VIRGIN ISLANDS (US)
*
*/
USD("US Dollar", 840, 2,
CountryCode.AS, CountryCode.BQ, CountryCode.EC, CountryCode.FM,
CountryCode.GU, CountryCode.HT, CountryCode.IO, CountryCode.MH,
CountryCode.MP, CountryCode.PA, CountryCode.PR, CountryCode.PW,
CountryCode.SV, CountryCode.TC, CountryCode.TL, CountryCode.UM,
CountryCode.US, CountryCode.VG, CountryCode.VI),
/**
* US Dollar (Next day)
* [numeric code = 997, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#US US}: UNITED STATES
*
*/
USN("US Dollar (Next day)", 997, 2, CountryCode.US)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* US Dollar (Same day)
* [numeric code = 998, minor unit = 2, fund]
*
* Used by:
*
* - {@link CountryCode#US US}: UNITED STATES
*
*/
USS("US Dollar (Same day)", 998, 2, CountryCode.US)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Uruguay Peso en Unidades Indexadas (URUIURUI)
* [numeric code = 940, minor unit = 0, fund]
*
* Used by:
*
* - {@link CountryCode#UY UY}: URUGUAY
*
*/
UYI("Uruguay Peso en Unidades Indexadas (URUIURUI)", 940, 0, CountryCode.UY)
{
@Override
public boolean isFund()
{
return true;
}
},
/**
* Peso Uruguayo
* [numeric code = 858, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#UY UY}: URUGUAY
*
*/
UYU("Peso Uruguayo", 858, 2, CountryCode.UY),
/**
* Uzbekistan Sum
* [numeric code = 860, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#UZ UZ}: UZBEKISTAN
*
*/
UZS("Uzbekistan Sum", 860, 2, CountryCode.UZ),
/**
* Bolivar
* [numeric code = 937, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#VE VE}: VENEZUELA, BOLIVARIAN REPUBLIC OF
*
*/
VEF("Bolivar", 937, 2, CountryCode.VE),
/**
* Dong
* [numeric code = 704, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#VN VN}: VIET NAM
*
*/
VND("Dong", 704, 0, CountryCode.VN),
/**
* Vatu
* [numeric code = 548, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#VU VU}: VANUATU
*
*/
VUV("Vatu", 548, 0, CountryCode.VU),
/**
* Tala
* [numeric code = 882, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#WS WS}: SAMOA
*
*/
WST("Tala", 882, 2, CountryCode.WS),
/**
* CFA Franc BEAC
* [numeric code = 950, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#CF CF}: CENTRAL AFRICAN REPUBLIC
*
- {@link CountryCode#CG CG}: CONGO
*
- {@link CountryCode#CM CM}: CAMEROON
*
- {@link CountryCode#GA GA}: GABON
*
- {@link CountryCode#GQ GQ}: EQUATORIAL GUINEA
*
- {@link CountryCode#TD TD}: CHAD
*
*/
XAF("CFA Franc BEAC", 950, 0,
CountryCode.CF, CountryCode.CG, CountryCode.CM, CountryCode.GA,
CountryCode.GQ, CountryCode.TD),
/**
* Silver
* [numeric code = 961, minor unit = -1, precious metal]
*/
XAG("Silver", 961, -1)
{
@Override
public boolean isPreciousMetal()
{
return true;
}
},
/**
* Gold
* [numeric code = 959, minor unit = -1, precious metal]
*/
XAU("Gold", 959, -1)
{
@Override
public boolean isPreciousMetal()
{
return true;
}
},
/**
* Bond Markets Unit European Composite Unit (EURCO)
* [numeric code = 955, minor unit = -1]
*/
XBA("Bond Markets Unit European Composite Unit (EURCO)", 955, -1),
/**
* Bond Markets Unit European Monetary Unit (E.M.U.-6)
* [numeric code = 956, minor unit = -1]
*/
XBB("Bond Markets Unit European Monetary Unit (E.M.U.-6)", 956, -1),
/**
* Bond Markets Unit European Unit of Account 9 (E.U.A.-9)
* [numeric code = 957, minor unit = -1]
*/
XBC("Bond Markets Unit European Unit of Account 9 (E.U.A.-9)", 957, -1),
/**
* Bond Markets Unit European Unit of Account 17 (E.U.A.-17)
* [numeric code = 958, minor unit = -1]
*/
XBD("Bond Markets Unit European Unit of Account 17 (E.U.A.-17)", 958, -1),
/**
* East Caribbean Dollar
* [numeric code = 951, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#AG AG}: ANTIGUA AND BARBUDA
*
- {@link CountryCode#AI AI}: ANGUILLA
*
- {@link CountryCode#DM DM}: DOMINICA
*
- {@link CountryCode#GD GD}: GRENADA
*
- {@link CountryCode#KN KN}: SAINT KITTS AND NEVIS
*
- {@link CountryCode#LC LC}: SAINT LUCIA
*
- {@link CountryCode#MS MS}: MONTSERRAT
*
- {@link CountryCode#VC VC}: SAINT VINCENT AND THE GRENADINES
*
*/
XCD("East Caribbean Dollar", 951, 2,
CountryCode.AG, CountryCode.AI, CountryCode.DM, CountryCode.GD,
CountryCode.KN, CountryCode.LC, CountryCode.MS, CountryCode.VC),
/**
* SDR (Special Drawing Right)
* [numeric code = 960, minor unit = -1]
*/
XDR("SDR (Special Drawing Right)", 960, -1),
/**
* CFA Franc BCEAO
* [numeric code = 952, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#BF BF}: BURKINA FASO
*
- {@link CountryCode#BJ BJ}: BENIN
*
- {@link CountryCode#CI CI}: CÔTE D'IVOIRE
*
- {@link CountryCode#GW GW}: GUINEA-BISSAU
*
- {@link CountryCode#ML ML}: MALI
*
- {@link CountryCode#NE NE}: NIGER
*
- {@link CountryCode#SN SN}: SENEGAL
*
- {@link CountryCode#TG TG}: TOGO
*
*/
XOF("CFA Franc BCEAO", 952, 0,
CountryCode.BF, CountryCode.BJ, CountryCode.CI, CountryCode.GW,
CountryCode.ML, CountryCode.NE, CountryCode.SN, CountryCode.TG),
/**
* Palladium
* [numeric code = 964, minor unit = -1, precious metal]
*/
XPD("Palladium", 964, -1)
{
@Override
public boolean isPreciousMetal()
{
return true;
}
},
/**
* CFP Franc
* [numeric code = 953, minor unit = 0]
*
* Used by:
*
* - {@link CountryCode#NC NC}: NEW CALEDONIA
*
- {@link CountryCode#PF PF}: FRENCH POLYNESIA
*
- {@link CountryCode#WF WF}: WALLIS AND FUTUNA
*
*/
XPF("CFP Franc", 953, 0, CountryCode.NC, CountryCode.PF, CountryCode.WF),
/**
* Platinum
* [numeric code = 962, minor unit = -1, precious metal]
*/
XPT("Platinum", 962, -1)
{
@Override
public boolean isPreciousMetal()
{
return true;
}
},
/**
* Sucre
* [numeric code = 994, minor unit = -1]
*/
XSU("Sucre", 994, -1),
/**
* Codes specifically reserved for testing purposes.
* [numeric code = 963, minor unit = -1]
*/
XTS("Codes specifically reserved for testing purposes", 963, -1),
/**
* ADB Unit of Account
* [numeric code = 965, minor unit = -1]
*/
XUA("ADB Unit of Account", 965, -1),
/**
* The codes assigned for transactions where no currency is involved
* [numeric code = 999, minor unit = -1]
*/
XXX("The codes assigned for transactions where no currency is involved", 999, -1),
/**
* Yemeni Rial
* [numeric code = 886, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#YE YE}: YEMEN
*
*/
YER("Yemeni Rial", 886, 2, CountryCode.YE),
/**
* Rand
* [numeric code = 710, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#LS LS}: LESOTHO
*
- {@link CountryCode#NA NA}: NAMIBIA
*
- {@link CountryCode#ZA ZA}: SOUTH AFRICA
*
*/
ZAR("Rand", 710, 2, CountryCode.LS, CountryCode.NA, CountryCode.ZA),
/**
* Zambian Kwacha
* [numeric code = 967, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#ZM ZM}: ZAMBIA
*
*/
ZMW("Zambian Kwacha", 967, 2, CountryCode.ZM),
/**
* Zimbabwe Dollar
* [numeric code = 932, minor unit = 2]
*
* Used by:
*
* - {@link CountryCode#ZW ZW}: ZIMBABWE
*
*/
ZWL("Zimbabwe Dollar", 932, 2, CountryCode.ZW),
;
private static final Map numericMap = new HashMap();
static
{
for (CurrencyCode cc : values())
{
numericMap.put(cc.getNumeric(), cc);
}
}
private final String name;
private final int numeric;
private final int minorUnit;
private final List countryList;
private CurrencyCode(String name, int numeric, int minorUnit, CountryCode... countries)
{
this.name = name;
this.numeric = numeric;
this.minorUnit = minorUnit;
this.countryList = Collections.unmodifiableList(Arrays.asList(countries));
}
/**
* Get the currency name.
*
* @return
* The currency name.
*/
public String getName()
{
return name;
}
/**
* Get the ISO 4217 numeric code.
*
* @return
* The ISO 4217
* numeric code.
*/
public int getNumeric()
{
return numeric;
}
/**
* Get the minor unit.
*
* @return
* The minor unit. {@code -1} means N.A.
*/
public int getMinorUnit()
{
return minorUnit;
}
/**
* Get the list of countries using this currency.
*
* @return
* The list of countries using this currency.
*/
public List getCountryList()
{
return countryList;
}
/**
* Check if this currency code represents a fund.
*
*
* {@code CurrencyCode} instances listed below return {@code true}.
*
*
*
* - {@link #BOV} Mvdol
*
- {@link #CHE} WIR EUro
*
- {@link #CHW} WIR Franc
*
- {@link #CLF} Unidad de Fomento
*
- {@link #COU} Unidad de Valor Real
*
- {@link #MXV} Mexican Unidad de Inversion (UDI)
*
- {@link #USN} US Dollar (Next day)
*
- {@link #USS} US Dollar (Same day)
*
- {@link #UYI} Uruguay Peso en Unidades
*
*
* @return
* True if this currency code represents a fund.
*/
public boolean isFund()
{
return false;
}
/**
* Check if this currency code represents a precious metal.
*
*
* {@code CurrencyCode} instances listed below return {@code true}.
*
*
*
* - {@link #XAG} Silver
*
- {@link #XAU} Gold
*
- {@link #XPD} Palladium
*
- {@link #XPT} Platinum
*
*
* @return
* True if this currency code represents a precious metal.
*/
public boolean isPreciousMetal()
{
return false;
}
/**
* Get the {@link Currency} instance that corresponds to
* this currency code.
*
*
* This method is an alias of {@link Currency}{@code .}{@link
* Currency#getInstance(String) getInstance}{@code (this.name())}.
* The only difference is that this method returns {@code null}
* when {@code Currency.getInstance(String)} throws {@code
* IllegalArgumentException}.
*
*
* @return
* A {@link Currency} instance, or {@code null} if this
* ISO 4217 code is not supported by the implementation
* of {@link Currency#getInstance(String)}.
*
* @see Currency#getInstance(String)
*/
public Currency getCurrency()
{
try
{
return Currency.getInstance(this.name());
}
catch (IllegalArgumentException e)
{
// Currency.getInstance(String) throws IllegalArgumentException
// when the given ISO 4217 code is not supported.
return null;
}
}
/**
* Get a {@code CurrencyCode} that corresponds to the given
* ISO 4217
* alpha-3 code.
*
*
* This method calls {@link #getByCode(String, boolean) getByCode}{@code (code, true)}.
* Note that the behavior has changed since the version 1.13. In the older versions,
* this method was an alias of {@code getByCode(code, false)}.
*
*
* @param code
* ISO 4217
* alpha-3 code.
* When {@code "UNDEFINED"} is given, {@link #UNDEFINED CurrencyCode.UNDEFINED}
* is returned.
*
* @return
* A {@code CurrencyCode} instance, or {@code null} if not found.
*
* @see #getByCode(String, boolean)
*/
public static CurrencyCode getByCode(String code)
{
return getByCode(code, true);
}
/**
* Get a {@code CurrencyCode} that corresponds to the given
* ISO 4217
* alpha-3 code.
*
*
* This method calls {@link #getByCode(String, boolean) getByCode}{@code (code, false)}.
*
*
* @param code
* ISO 4217
* alpha-3 code. Or {@code "UNDEFINED"} (case insensitive).
*
* @return
* A {@code CurrencyCode} instance, or {@code null} if not found.
*
* @since 1.13
*
* @see #getByCode(String, boolean)
*/
public static CurrencyCode getByCodeIgnoreCase(String code)
{
return getByCode(code, false);
}
/**
* Get a {@code CurrencyCode} that corresponds to the given
* ISO 4217
* alpha-3 code.
*
* @param code
* ISO 4217
* alpha-3 code.
* Or {@code "UNDEFINED"} (its case sensitivity depends on the value of
* {@code caseSensitive}).
*
* @param caseSensitive
* If {@code true}, the given code should consist of upper-case letters only.
* If {@code false}, this method internally canonicalizes the given code by
* {@link String#toUpperCase()} and then performs search. For example,
* {@code getByCode("jpy", true)} returns {@code null}, but on the other hand,
* {@code getByCode("jpy", false)} returns {@link #JPY CurrencyCode.JPY}.
*
* @return
* A {@code CurrencyCode} instance, or {@code null} if not found.
*/
public static CurrencyCode getByCode(String code, boolean caseSensitive)
{
code = canonicalize(code, caseSensitive);
if (code == null)
{
return null;
}
try
{
return Enum.valueOf(CurrencyCode.class, code);
}
catch (IllegalArgumentException e)
{
return null;
}
}
/**
* Get a {@code CurrencyCode} that corresponds to the given
* ISO 4217
* numeric code.
*
* @param code
* ISO 4217
* numeric code.
*
* @return
* A {@code CurrencyCode} instance, or {@code null} if not found.
* If 0 or a negative value is given, {@code null} is returned.
*/
public static CurrencyCode getByCode(int code)
{
if (code <= 0)
{
return null;
}
return numericMap.get(code);
}
private static String canonicalize(String code, boolean caseSensitive)
{
if (code == null || code.length() == 0)
{
return null;
}
if (caseSensitive)
{
return code;
}
else
{
return code.toUpperCase();
}
}
/**
* Get a list of {@code CurrencyCode} instances whose country
* list contains the specified country.
*
*
* This method is an alias of {@link #getByCountry(String, boolean)
* getByCountry}{@code (country, true)}.
* Note that the behavior has changed since the version 1.13.
* In the older versions, this method was an alias of {@code
* getByCountry(code, false)}.
*
*
* @param country
* Country code. ISO 3166-1 alpha-2 or alpha-3.
*
* @return
* List of {@code CurrencyCode} instances. If there is no
* {@code CurrencyCode} instance whose country list contains
* the specified country, the size of the returned list is zero.
*/
public static List getByCountry(String country)
{
return getByCountry(country, true);
}
/**
* Get a list of {@code CurrencyCode} instances whose country
* list contains the specified country.
*
*
* This method is an alias of {@link #getByCountry(String, boolean)
* getByCountry}{@code (country, false)}.
*
*
* @param country
* Country code. ISO 3166-1 alpha-2 or alpha-3.
*
* @return
* List of {@code CurrencyCode} instances. If there is no
* {@code CurrencyCode} instance whose country list contains
* the specified country, the size of the returned list is zero.
*
* @since 1.13
*/
public static List getByCountryIgnoreCase(String country)
{
return getByCountry(country, false);
}
/**
* Get a list of {@code CurrencyCode} instances whose country
* list contains the specified country.
*
*
* This method is an alias of {@link #getByCountry(CountryCode)
* getByCountry}{@code (}{@link CountryCode}{@code .}{@link
* CountryCode#getByCode(String, boolean) getByCode}{@code
* (country, caseSensitive))}.
*
*
* @param country
* Country code. ISO 3166-1 alpha-2 or alpha-3.
*
* @param caseSensitive
* If {@code true}, the given code should consist of uppercase
* letters only. If {@code false}, case is ignored.
*
* @return
* List of {@code CurrencyCode} instances. If there is no
* {@code CurrencyCode} instance whose country list contains
* the specified country, the size of the returned list is zero.
*/
public static List getByCountry(String country, boolean caseSensitive)
{
return getByCountry(CountryCode.getByCode(country, caseSensitive));
}
/**
* Get a list of {@code CurrencyCode} instances whose country list
* contains the specified country.
*
* @param country
* {@code CountryCode} instance that represents a country.
*
* @return
* List of {@code CurrencyCode} instances. If there is no
* {@code CurrencyCode} instance whose country list contains
* the specified country, the size of the returned list is zero.
*/
public static List getByCountry(CountryCode country)
{
List list = new ArrayList();
if (country == null)
{
return list;
}
for (CurrencyCode currency : values())
{
for (CountryCode cc : currency.countryList)
{
if (cc == country)
{
list.add(currency);
}
}
}
return list;
}
/**
* Get a list of {@code CurrencyCode} by a name regular expression.
*
*
* This method is almost equivalent to {@link #findByName(Pattern)
* findByName}{@code (Pattern.compile(regex))}.
*
*
* @param regex
* Regular expression for names.
*
* @return
* List of {@code CurrencyCode}. If nothing has matched,
* an empty list is returned.
*
* @throws IllegalArgumentException
* {@code regex} is {@code null}.
*
* @throws java.util.regex.PatternSyntaxException
* {@code regex} failed to be compiled.
*
* @since 1.11
*/
public static List findByName(String regex)
{
if (regex == null)
{
throw new IllegalArgumentException("regex is null.");
}
// Compile the regular expression. This may throw
// java.util.regex.PatternSyntaxException.
Pattern pattern = Pattern.compile(regex);
return findByName(pattern);
}
/**
* Get a list of {@code CurrencyCode} by a name pattern.
*
*
* For example, the list obtained by the code snippet below:
*
*
*
* Pattern pattern = Pattern.compile(".*Ruble");
* List<CurrencyCode> list = CurrencyCode.findByName(pattern);
*
*
* contains 2 {@code CurrencyCode}s as listed below.
*
*
*
* - {@link #BYR} : Belarussian Ruble
*
- {@link #RUB} : Russian Ruble
*
*
* @param pattern
* Pattern to match names.
*
* @return
* List of {@code CurrencyCde}. If nothing has matched,
* an empty list is returned.
*
* @throws IllegalArgumentException
* {@code pattern} is {@code null}.
*
* @since 1.11
*/
public static List findByName(Pattern pattern)
{
if (pattern == null)
{
throw new IllegalArgumentException("pattern is null.");
}
List list = new ArrayList();
for (CurrencyCode entry : values())
{
// If the name matches the given pattern.
if (pattern.matcher(entry.getName()).matches())
{
list.add(entry);
}
}
return list;
}
}