Enum Class CountryCode
- All Implemented Interfaces:
Serializable, Comparable<CountryCode>, Constable
An enumeration of the ISO 3166-1 alpha-2
country codes, as used by Spotify's
market and country parameters.
The constant name is the alpha-2 code itself, so toString() yields exactly what the Web API
expects on the wire. The list is Locale.getISOCountries() plus XK, which is
user-assigned rather than ISO-assigned but is the one market code Spotify returns that the JDK omits.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAndorra.United Arab Emirates.Afghanistan.Antigua & Barbuda.Anguilla.Albania.Armenia.Angola.Antarctica.Argentina.American Samoa.Austria.Australia.Aruba.Åland Islands.Azerbaijan.Bosnia & Herzegovina.Barbados.Bangladesh.Belgium.Burkina Faso.Bulgaria.Bahrain.Burundi.Benin.St.Bermuda.Brunei.Bolivia.Caribbean Netherlands.Brazil.Bahamas.Bhutan.Bouvet Island.Botswana.Belarus.Belize.Canada.Cocos (Keeling) Islands.Congo - Kinshasa.Central African Republic.Congo - Brazzaville.Switzerland.Côte d’Ivoire.Cook Islands.Chile.Cameroon.China.Colombia.Costa Rica.Cuba.Cape Verde.Curaçao.Christmas Island.Cyprus.Czechia.Germany.Djibouti.Denmark.Dominica.Dominican Republic.Algeria.Ecuador.Estonia.Egypt.Western Sahara.Eritrea.Spain.Ethiopia.Finland.Fiji.Falkland Islands.Micronesia.Faroe Islands.France.Gabon.United Kingdom.Grenada.Georgia.French Guiana.Guernsey.Ghana.Gibraltar.Greenland.Gambia.Guinea.Guadeloupe.Equatorial Guinea.Greece.South Georgia & South Sandwich Islands.Guatemala.Guam.Guinea-Bissau.Guyana.Hong Kong SAR China.Heard & McDonald Islands.Honduras.Croatia.Haiti.Hungary.Indonesia.Ireland.Israel.Isle of Man.India.British Indian Ocean Territory.Iraq.Iran.Iceland.Italy.Jersey.Jamaica.Jordan.Japan.Kenya.Kyrgyzstan.Cambodia.Kiribati.Comoros.St.North Korea.South Korea.Kuwait.Cayman Islands.Kazakhstan.Laos.Lebanon.St.Liechtenstein.Sri Lanka.Liberia.Lesotho.Lithuania.Luxembourg.Latvia.Libya.Morocco.Monaco.Moldova.Montenegro.St.Madagascar.Marshall Islands.North Macedonia.Mali.Myanmar (Burma).Mongolia.Macao SAR China.Northern Mariana Islands.Martinique.Mauritania.Montserrat.Malta.Mauritius.Maldives.Malawi.Mexico.Malaysia.Mozambique.Namibia.New Caledonia.Niger.Norfolk Island.Nigeria.Nicaragua.Netherlands.Norway.Nepal.Nauru.Niue.New Zealand.Oman.Panama.Peru.French Polynesia.Papua New Guinea.Philippines.Pakistan.Poland.St.Pitcairn Islands.Puerto Rico.Palestinian Territories.Portugal.Palau.Paraguay.Qatar.Réunion.Romania.Serbia.Russia.Rwanda.Saudi Arabia.Solomon Islands.Seychelles.Sudan.Sweden.Singapore.St.Slovenia.Svalbard & Jan Mayen.Slovakia.Sierra Leone.San Marino.Senegal.Somalia.Suriname.South Sudan.São Tomé & Príncipe.El Salvador.Sint Maarten.Syria.Eswatini.Turks & Caicos Islands.Chad.French Southern Territories.Togo.Thailand.Tajikistan.Tokelau.Timor-Leste.Turkmenistan.Tunisia.Tonga.Türkiye.Trinidad & Tobago.Tuvalu.Taiwan.Tanzania.Ukraine.Uganda.U.S.United States.Uruguay.Uzbekistan.Vatican City.St.Venezuela.British Virgin Islands.U.S.Vietnam.Vanuatu.Wallis & Futuna.Samoa.Kosovo (user-assigned code, served by Spotify as a market).Yemen.Mayotte.South Africa.Zambia.Zimbabwe. -
Method Summary
Modifier and TypeMethodDescriptionGet the ISO 3166-1 alpha-2 code.static CountryCodeGet a CountryCode by its ISO 3166-1 alpha-2 code.static CountryCodeReturns the enum constant of this class with the specified name.static CountryCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AD
Andorra. -
AE
United Arab Emirates. -
AF
Afghanistan. -
AG
Antigua & Barbuda. -
AI
Anguilla. -
AL
Albania. -
AM
Armenia. -
AO
Angola. -
AQ
Antarctica. -
AR
Argentina. -
AS
American Samoa. -
AT
Austria. -
AU
Australia. -
AW
Aruba. -
AX
Åland Islands. -
AZ
Azerbaijan. -
BA
Bosnia & Herzegovina. -
BB
Barbados. -
BD
Bangladesh. -
BE
Belgium. -
BF
Burkina Faso. -
BG
Bulgaria. -
BH
Bahrain. -
BI
Burundi. -
BJ
Benin. -
BL
St. Barthélemy. -
BM
Bermuda. -
BN
Brunei. -
BO
Bolivia. -
BQ
Caribbean Netherlands. -
BR
Brazil. -
BS
Bahamas. -
BT
Bhutan. -
BV
Bouvet Island. -
BW
Botswana. -
BY
Belarus. -
BZ
Belize. -
CA
Canada. -
CC
Cocos (Keeling) Islands. -
CD
Congo - Kinshasa. -
CF
Central African Republic. -
CG
Congo - Brazzaville. -
CH
Switzerland. -
CI
Côte d’Ivoire. -
CK
Cook Islands. -
CL
Chile. -
CM
Cameroon. -
CN
China. -
CO
Colombia. -
CR
Costa Rica. -
CU
Cuba. -
CV
Cape Verde. -
CW
Curaçao. -
CX
Christmas Island. -
CY
Cyprus. -
CZ
Czechia. -
DE
Germany. -
DJ
Djibouti. -
DK
Denmark. -
DM
Dominica. -
DO
Dominican Republic. -
DZ
Algeria. -
EC
Ecuador. -
EE
Estonia. -
EG
Egypt. -
EH
Western Sahara. -
ER
Eritrea. -
ES
Spain. -
ET
Ethiopia. -
FI
Finland. -
FJ
Fiji. -
FK
Falkland Islands. -
FM
Micronesia. -
FO
Faroe Islands. -
FR
France. -
GA
Gabon. -
GB
United Kingdom. -
GD
Grenada. -
GE
Georgia. -
GF
French Guiana. -
GG
Guernsey. -
GH
Ghana. -
GI
Gibraltar. -
GL
Greenland. -
GM
Gambia. -
GN
Guinea. -
GP
Guadeloupe. -
GQ
Equatorial Guinea. -
GR
Greece. -
GS
South Georgia & South Sandwich Islands. -
GT
Guatemala. -
GU
Guam. -
GW
Guinea-Bissau. -
GY
Guyana. -
HK
Hong Kong SAR China. -
HM
Heard & McDonald Islands. -
HN
Honduras. -
HR
Croatia. -
HT
Haiti. -
HU
Hungary. -
ID
Indonesia. -
IE
Ireland. -
IL
Israel. -
IM
Isle of Man. -
IN
India. -
IO
British Indian Ocean Territory. -
IQ
Iraq. -
IR
Iran. -
IS
Iceland. -
IT
Italy. -
JE
Jersey. -
JM
Jamaica. -
JO
Jordan. -
JP
Japan. -
KE
Kenya. -
KG
Kyrgyzstan. -
KH
Cambodia. -
KI
Kiribati. -
KM
Comoros. -
KN
St. Kitts & Nevis. -
KP
North Korea. -
KR
South Korea. -
KW
Kuwait. -
KY
Cayman Islands. -
KZ
Kazakhstan. -
LA
Laos. -
LB
Lebanon. -
LC
St. Lucia. -
LI
Liechtenstein. -
LK
Sri Lanka. -
LR
Liberia. -
LS
Lesotho. -
LT
Lithuania. -
LU
Luxembourg. -
LV
Latvia. -
LY
Libya. -
MA
Morocco. -
MC
Monaco. -
MD
Moldova. -
ME
Montenegro. -
MF
St. Martin. -
MG
Madagascar. -
MH
Marshall Islands. -
MK
North Macedonia. -
ML
Mali. -
MM
Myanmar (Burma). -
MN
Mongolia. -
MO
Macao SAR China. -
MP
Northern Mariana Islands. -
MQ
Martinique. -
MR
Mauritania. -
MS
Montserrat. -
MT
Malta. -
MU
Mauritius. -
MV
Maldives. -
MW
Malawi. -
MX
Mexico. -
MY
Malaysia. -
MZ
Mozambique. -
NA
Namibia. -
NC
New Caledonia. -
NE
Niger. -
NF
Norfolk Island. -
NG
Nigeria. -
NI
Nicaragua. -
NL
Netherlands. -
NO
Norway. -
NP
Nepal. -
NR
Nauru. -
NU
Niue. -
NZ
New Zealand. -
OM
Oman. -
PA
Panama. -
PE
Peru. -
PF
French Polynesia. -
PG
Papua New Guinea. -
PH
Philippines. -
PK
Pakistan. -
PL
Poland. -
PM
St. Pierre & Miquelon. -
PN
Pitcairn Islands. -
PR
Puerto Rico. -
PS
Palestinian Territories. -
PT
Portugal. -
PW
Palau. -
PY
Paraguay. -
QA
Qatar. -
RE
Réunion. -
RO
Romania. -
RS
Serbia. -
RU
Russia. -
RW
Rwanda. -
SA
Saudi Arabia. -
SB
Solomon Islands. -
SC
Seychelles. -
SD
Sudan. -
SE
Sweden. -
SG
Singapore. -
SH
St. Helena. -
SI
Slovenia. -
SJ
Svalbard & Jan Mayen. -
SK
Slovakia. -
SL
Sierra Leone. -
SM
San Marino. -
SN
Senegal. -
SO
Somalia. -
SR
Suriname. -
SS
South Sudan. -
ST
São Tomé & Príncipe. -
SV
El Salvador. -
SX
Sint Maarten. -
SY
Syria. -
SZ
Eswatini. -
TC
Turks & Caicos Islands. -
TD
Chad. -
TF
French Southern Territories. -
TG
Togo. -
TH
Thailand. -
TJ
Tajikistan. -
TK
Tokelau. -
TL
Timor-Leste. -
TM
Turkmenistan. -
TN
Tunisia. -
TO
Tonga. -
TR
Türkiye. -
TT
Trinidad & Tobago. -
TV
Tuvalu. -
TW
Taiwan. -
TZ
Tanzania. -
UA
Ukraine. -
UG
Uganda. -
UM
U.S. Outlying Islands. -
US
United States. -
UY
Uruguay. -
UZ
Uzbekistan. -
VA
Vatican City. -
VC
St. Vincent & Grenadines. -
VE
Venezuela. -
VG
British Virgin Islands. -
VI
U.S. Virgin Islands. -
VN
Vietnam. -
VU
Vanuatu. -
WF
Wallis & Futuna. -
WS
Samoa. -
XK
Kosovo (user-assigned code, served by Spotify as a market). -
YE
Yemen. -
YT
Mayotte. -
ZA
South Africa. -
ZM
Zambia. -
ZW
Zimbabwe.
-
-
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
-
getByCode
Get a CountryCode by its ISO 3166-1 alpha-2 code.- Parameters:
code- The two-letter country code, matched case-insensitively.- Returns:
- The corresponding CountryCode or null if there is none.
-
getAlpha2
-