001/*
002 * oauth2-oidc-sdk
003 *
004 * Copyright 2012-2016, Connect2id Ltd and contributors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use
007 * this file except in compliance with the License. You may obtain a copy of the
008 * License at
009 *
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software distributed
013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
015 * specific language governing permissions and limitations under the License.
016 */
017
018package com.nimbusds.openid.connect.sdk.assurance.claims;
019
020
021import java.io.IOException;
022import java.io.InputStream;
023import java.util.Properties;
024
025import net.jcip.annotations.Immutable;
026
027import com.nimbusds.oauth2.sdk.ParseException;
028
029
030/**
031 * ISO 3166-1 alpha-2 (two-letter) country code.
032 *
033 * <p>Includes constants for all 249 current officially assigned ISO 3166-1
034 * alpha-2 codes.
035 */
036@Immutable
037public final class ISO3166_1Alpha2CountryCode extends ISO3166_1AlphaCountryCode {
038
039
040        private static final long serialVersionUID = -7659886425656766569L;
041
042
043        // Codes extracted from Markdown at https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
044
045        /** Andorra */
046        public static final ISO3166_1Alpha2CountryCode AD = new ISO3166_1Alpha2CountryCode("AD");
047
048        /** United Arab Emirates */
049        public static final ISO3166_1Alpha2CountryCode AE = new ISO3166_1Alpha2CountryCode("AE");
050
051        /** Afghanistan */
052        public static final ISO3166_1Alpha2CountryCode AF = new ISO3166_1Alpha2CountryCode("AF");
053
054        /** Antigua and Barbuda */
055        public static final ISO3166_1Alpha2CountryCode AG = new ISO3166_1Alpha2CountryCode("AG");
056
057        /** Anguilla */
058        public static final ISO3166_1Alpha2CountryCode AI = new ISO3166_1Alpha2CountryCode("AI");
059
060        /** Albania */
061        public static final ISO3166_1Alpha2CountryCode AL = new ISO3166_1Alpha2CountryCode("AL");
062
063        /** Armenia */
064        public static final ISO3166_1Alpha2CountryCode AM = new ISO3166_1Alpha2CountryCode("AM");
065
066        /** Angola */
067        public static final ISO3166_1Alpha2CountryCode AO = new ISO3166_1Alpha2CountryCode("AO");
068
069        /** Antarctica */
070        public static final ISO3166_1Alpha2CountryCode AQ = new ISO3166_1Alpha2CountryCode("AQ");
071
072        /** Argentina */
073        public static final ISO3166_1Alpha2CountryCode AR = new ISO3166_1Alpha2CountryCode("AR");
074
075        /** American Samoa */
076        public static final ISO3166_1Alpha2CountryCode AS = new ISO3166_1Alpha2CountryCode("AS");
077
078        /** Austria */
079        public static final ISO3166_1Alpha2CountryCode AT = new ISO3166_1Alpha2CountryCode("AT");
080
081        /** Australia */
082        public static final ISO3166_1Alpha2CountryCode AU = new ISO3166_1Alpha2CountryCode("AU");
083
084        /** Aruba */
085        public static final ISO3166_1Alpha2CountryCode AW = new ISO3166_1Alpha2CountryCode("AW");
086
087        /** Aland Islands */
088        public static final ISO3166_1Alpha2CountryCode AX = new ISO3166_1Alpha2CountryCode("AX");
089
090        /** Azerbaijan */
091        public static final ISO3166_1Alpha2CountryCode AZ = new ISO3166_1Alpha2CountryCode("AZ");
092
093        /** Bosnia and Herzegovina */
094        public static final ISO3166_1Alpha2CountryCode BA = new ISO3166_1Alpha2CountryCode("BA");
095
096        /** Barbados */
097        public static final ISO3166_1Alpha2CountryCode BB = new ISO3166_1Alpha2CountryCode("BB");
098
099        /** Bangladesh */
100        public static final ISO3166_1Alpha2CountryCode BD = new ISO3166_1Alpha2CountryCode("BD");
101
102        /** Belgium */
103        public static final ISO3166_1Alpha2CountryCode BE = new ISO3166_1Alpha2CountryCode("BE");
104
105        /** Burkina Faso */
106        public static final ISO3166_1Alpha2CountryCode BF = new ISO3166_1Alpha2CountryCode("BF");
107
108        /** Bulgaria */
109        public static final ISO3166_1Alpha2CountryCode BG = new ISO3166_1Alpha2CountryCode("BG");
110
111        /** Bahrain */
112        public static final ISO3166_1Alpha2CountryCode BH = new ISO3166_1Alpha2CountryCode("BH");
113
114        /** Burundi */
115        public static final ISO3166_1Alpha2CountryCode BI = new ISO3166_1Alpha2CountryCode("BI");
116
117        /** Benin */
118        public static final ISO3166_1Alpha2CountryCode BJ = new ISO3166_1Alpha2CountryCode("BJ");
119
120        /** Saint Barthélemy */
121        public static final ISO3166_1Alpha2CountryCode BL = new ISO3166_1Alpha2CountryCode("BL");
122
123        /** Bermuda */
124        public static final ISO3166_1Alpha2CountryCode BM = new ISO3166_1Alpha2CountryCode("BM");
125
126        /** Brunei Darussalam */
127        public static final ISO3166_1Alpha2CountryCode BN = new ISO3166_1Alpha2CountryCode("BN");
128
129        /** Bolivia (Plurinational State of) */
130        public static final ISO3166_1Alpha2CountryCode BO = new ISO3166_1Alpha2CountryCode("BO");
131
132        /** Bonaire, Sint Eustatius and Saba */
133        public static final ISO3166_1Alpha2CountryCode BQ = new ISO3166_1Alpha2CountryCode("BQ");
134
135        /** Brazil */
136        public static final ISO3166_1Alpha2CountryCode BR = new ISO3166_1Alpha2CountryCode("BR");
137
138        /** Bahamas */
139        public static final ISO3166_1Alpha2CountryCode BS = new ISO3166_1Alpha2CountryCode("BS");
140
141        /** Bhutan */
142        public static final ISO3166_1Alpha2CountryCode BT = new ISO3166_1Alpha2CountryCode("BT");
143
144        /** Bouvet Island */
145        public static final ISO3166_1Alpha2CountryCode BV = new ISO3166_1Alpha2CountryCode("BV");
146
147        /** Botswana */
148        public static final ISO3166_1Alpha2CountryCode BW = new ISO3166_1Alpha2CountryCode("BW");
149
150        /** Belarus */
151        public static final ISO3166_1Alpha2CountryCode BY = new ISO3166_1Alpha2CountryCode("BY");
152
153        /** Belize */
154        public static final ISO3166_1Alpha2CountryCode BZ = new ISO3166_1Alpha2CountryCode("BZ");
155
156        /** Canada */
157        public static final ISO3166_1Alpha2CountryCode CA = new ISO3166_1Alpha2CountryCode("CA");
158
159        /** Cocos (Keeling) Islands */
160        public static final ISO3166_1Alpha2CountryCode CC = new ISO3166_1Alpha2CountryCode("CC");
161
162        /** Congo, Democratic Republic of the */
163        public static final ISO3166_1Alpha2CountryCode CD = new ISO3166_1Alpha2CountryCode("CD");
164
165        /** Central African Republic */
166        public static final ISO3166_1Alpha2CountryCode CF = new ISO3166_1Alpha2CountryCode("CF");
167
168        /** Congo */
169        public static final ISO3166_1Alpha2CountryCode CG = new ISO3166_1Alpha2CountryCode("CG");
170
171        /** Switzerland */
172        public static final ISO3166_1Alpha2CountryCode CH = new ISO3166_1Alpha2CountryCode("CH");
173
174        /** Côte d'Ivoire */
175        public static final ISO3166_1Alpha2CountryCode CI = new ISO3166_1Alpha2CountryCode("CI");
176
177        /** Cook Islands */
178        public static final ISO3166_1Alpha2CountryCode CK = new ISO3166_1Alpha2CountryCode("CK");
179
180        /** Chile */
181        public static final ISO3166_1Alpha2CountryCode CL = new ISO3166_1Alpha2CountryCode("CL");
182
183        /** Cameroon */
184        public static final ISO3166_1Alpha2CountryCode CM = new ISO3166_1Alpha2CountryCode("CM");
185
186        /** China */
187        public static final ISO3166_1Alpha2CountryCode CN = new ISO3166_1Alpha2CountryCode("CN");
188
189        /** Colombia */
190        public static final ISO3166_1Alpha2CountryCode CO = new ISO3166_1Alpha2CountryCode("CO");
191
192        /** Costa Rica */
193        public static final ISO3166_1Alpha2CountryCode CR = new ISO3166_1Alpha2CountryCode("CR");
194
195        /** Cuba */
196        public static final ISO3166_1Alpha2CountryCode CU = new ISO3166_1Alpha2CountryCode("CU");
197
198        /** Cabo Verde */
199        public static final ISO3166_1Alpha2CountryCode CV = new ISO3166_1Alpha2CountryCode("CV");
200
201        /** Curaçao */
202        public static final ISO3166_1Alpha2CountryCode CW = new ISO3166_1Alpha2CountryCode("CW");
203
204        /** Christmas Island */
205        public static final ISO3166_1Alpha2CountryCode CX = new ISO3166_1Alpha2CountryCode("CX");
206
207        /** Cyprus */
208        public static final ISO3166_1Alpha2CountryCode CY = new ISO3166_1Alpha2CountryCode("CY");
209
210        /** Czechia */
211        public static final ISO3166_1Alpha2CountryCode CZ = new ISO3166_1Alpha2CountryCode("CZ");
212
213        /** Germany */
214        public static final ISO3166_1Alpha2CountryCode DE = new ISO3166_1Alpha2CountryCode("DE");
215
216        /** Djibouti */
217        public static final ISO3166_1Alpha2CountryCode DJ = new ISO3166_1Alpha2CountryCode("DJ");
218
219        /** Denmark */
220        public static final ISO3166_1Alpha2CountryCode DK = new ISO3166_1Alpha2CountryCode("DK");
221
222        /** Dominica */
223        public static final ISO3166_1Alpha2CountryCode DM = new ISO3166_1Alpha2CountryCode("DM");
224
225        /** Dominican Republic */
226        public static final ISO3166_1Alpha2CountryCode DO = new ISO3166_1Alpha2CountryCode("DO");
227
228        /** Algeria */
229        public static final ISO3166_1Alpha2CountryCode DZ = new ISO3166_1Alpha2CountryCode("DZ");
230
231        /** Ecuador */
232        public static final ISO3166_1Alpha2CountryCode EC = new ISO3166_1Alpha2CountryCode("EC");
233
234        /** Estonia */
235        public static final ISO3166_1Alpha2CountryCode EE = new ISO3166_1Alpha2CountryCode("EE");
236
237        /** Egypt */
238        public static final ISO3166_1Alpha2CountryCode EG = new ISO3166_1Alpha2CountryCode("EG");
239
240        /** Western Sahara */
241        public static final ISO3166_1Alpha2CountryCode EH = new ISO3166_1Alpha2CountryCode("EH");
242
243        /** Eritrea */
244        public static final ISO3166_1Alpha2CountryCode ER = new ISO3166_1Alpha2CountryCode("ER");
245
246        /** Spain */
247        public static final ISO3166_1Alpha2CountryCode ES = new ISO3166_1Alpha2CountryCode("ES");
248
249        /** Ethiopia */
250        public static final ISO3166_1Alpha2CountryCode ET = new ISO3166_1Alpha2CountryCode("ET");
251
252        /** Finland */
253        public static final ISO3166_1Alpha2CountryCode FI = new ISO3166_1Alpha2CountryCode("FI");
254
255        /** Fiji */
256        public static final ISO3166_1Alpha2CountryCode FJ = new ISO3166_1Alpha2CountryCode("FJ");
257
258        /** Falkland Islands (Malvinas) */
259        public static final ISO3166_1Alpha2CountryCode FK = new ISO3166_1Alpha2CountryCode("FK");
260
261        /** Micronesia (Federated States of) */
262        public static final ISO3166_1Alpha2CountryCode FM = new ISO3166_1Alpha2CountryCode("FM");
263
264        /** Faroe Islands */
265        public static final ISO3166_1Alpha2CountryCode FO = new ISO3166_1Alpha2CountryCode("FO");
266
267        /** France */
268        public static final ISO3166_1Alpha2CountryCode FR = new ISO3166_1Alpha2CountryCode("FR");
269
270        /** Gabon */
271        public static final ISO3166_1Alpha2CountryCode GA = new ISO3166_1Alpha2CountryCode("GA");
272
273        /** United Kingdom of Great Britain and Northern Ireland */
274        public static final ISO3166_1Alpha2CountryCode GB = new ISO3166_1Alpha2CountryCode("GB");
275
276        /** Grenada */
277        public static final ISO3166_1Alpha2CountryCode GD = new ISO3166_1Alpha2CountryCode("GD");
278
279        /** Georgia */
280        public static final ISO3166_1Alpha2CountryCode GE = new ISO3166_1Alpha2CountryCode("GE");
281
282        /** French Guiana */
283        public static final ISO3166_1Alpha2CountryCode GF = new ISO3166_1Alpha2CountryCode("GF");
284
285        /** Guernsey */
286        public static final ISO3166_1Alpha2CountryCode GG = new ISO3166_1Alpha2CountryCode("GG");
287
288        /** Ghana */
289        public static final ISO3166_1Alpha2CountryCode GH = new ISO3166_1Alpha2CountryCode("GH");
290
291        /** Gibraltar */
292        public static final ISO3166_1Alpha2CountryCode GI = new ISO3166_1Alpha2CountryCode("GI");
293
294        /** Greenland */
295        public static final ISO3166_1Alpha2CountryCode GL = new ISO3166_1Alpha2CountryCode("GL");
296
297        /** Gambia */
298        public static final ISO3166_1Alpha2CountryCode GM = new ISO3166_1Alpha2CountryCode("GM");
299
300        /** Guinea */
301        public static final ISO3166_1Alpha2CountryCode GN = new ISO3166_1Alpha2CountryCode("GN");
302
303        /** Guadeloupe */
304        public static final ISO3166_1Alpha2CountryCode GP = new ISO3166_1Alpha2CountryCode("GP");
305
306        /** Equatorial Guinea */
307        public static final ISO3166_1Alpha2CountryCode GQ = new ISO3166_1Alpha2CountryCode("GQ");
308
309        /** Greece */
310        public static final ISO3166_1Alpha2CountryCode GR = new ISO3166_1Alpha2CountryCode("GR");
311
312        /** South Georgia and the South Sandwich Islands */
313        public static final ISO3166_1Alpha2CountryCode GS = new ISO3166_1Alpha2CountryCode("GS");
314
315        /** Guatemala */
316        public static final ISO3166_1Alpha2CountryCode GT = new ISO3166_1Alpha2CountryCode("GT");
317
318        /** Guam */
319        public static final ISO3166_1Alpha2CountryCode GU = new ISO3166_1Alpha2CountryCode("GU");
320
321        /** Guinea-Bissau */
322        public static final ISO3166_1Alpha2CountryCode GW = new ISO3166_1Alpha2CountryCode("GW");
323
324        /** Guyana */
325        public static final ISO3166_1Alpha2CountryCode GY = new ISO3166_1Alpha2CountryCode("GY");
326
327        /** Hong Kong */
328        public static final ISO3166_1Alpha2CountryCode HK = new ISO3166_1Alpha2CountryCode("HK");
329
330        /** Heard Island and McDonald Islands */
331        public static final ISO3166_1Alpha2CountryCode HM = new ISO3166_1Alpha2CountryCode("HM");
332
333        /** Honduras */
334        public static final ISO3166_1Alpha2CountryCode HN = new ISO3166_1Alpha2CountryCode("HN");
335
336        /** Croatia */
337        public static final ISO3166_1Alpha2CountryCode HR = new ISO3166_1Alpha2CountryCode("HR");
338
339        /** Haiti */
340        public static final ISO3166_1Alpha2CountryCode HT = new ISO3166_1Alpha2CountryCode("HT");
341
342        /** Hungary */
343        public static final ISO3166_1Alpha2CountryCode HU = new ISO3166_1Alpha2CountryCode("HU");
344
345        /** Indonesia */
346        public static final ISO3166_1Alpha2CountryCode ID = new ISO3166_1Alpha2CountryCode("ID");
347
348        /** Ireland */
349        public static final ISO3166_1Alpha2CountryCode IE = new ISO3166_1Alpha2CountryCode("IE");
350
351        /** Israel */
352        public static final ISO3166_1Alpha2CountryCode IL = new ISO3166_1Alpha2CountryCode("IL");
353
354        /** Isle of Man */
355        public static final ISO3166_1Alpha2CountryCode IM = new ISO3166_1Alpha2CountryCode("IM");
356
357        /** India */
358        public static final ISO3166_1Alpha2CountryCode IN = new ISO3166_1Alpha2CountryCode("IN");
359
360        /** British Indian Ocean Territory */
361        public static final ISO3166_1Alpha2CountryCode IO = new ISO3166_1Alpha2CountryCode("IO");
362
363        /** Iraq */
364        public static final ISO3166_1Alpha2CountryCode IQ = new ISO3166_1Alpha2CountryCode("IQ");
365
366        /** Iran (Islamic Republic of) */
367        public static final ISO3166_1Alpha2CountryCode IR = new ISO3166_1Alpha2CountryCode("IR");
368
369        /** Iceland */
370        public static final ISO3166_1Alpha2CountryCode IS = new ISO3166_1Alpha2CountryCode("IS");
371
372        /** Italy */
373        public static final ISO3166_1Alpha2CountryCode IT = new ISO3166_1Alpha2CountryCode("IT");
374
375        /** Jersey */
376        public static final ISO3166_1Alpha2CountryCode JE = new ISO3166_1Alpha2CountryCode("JE");
377
378        /** Jamaica */
379        public static final ISO3166_1Alpha2CountryCode JM = new ISO3166_1Alpha2CountryCode("JM");
380
381        /** Jordan */
382        public static final ISO3166_1Alpha2CountryCode JO = new ISO3166_1Alpha2CountryCode("JO");
383
384        /** Japan */
385        public static final ISO3166_1Alpha2CountryCode JP = new ISO3166_1Alpha2CountryCode("JP");
386
387        /** Kenya */
388        public static final ISO3166_1Alpha2CountryCode KE = new ISO3166_1Alpha2CountryCode("KE");
389
390        /** Kyrgyzstan */
391        public static final ISO3166_1Alpha2CountryCode KG = new ISO3166_1Alpha2CountryCode("KG");
392
393        /** Cambodia */
394        public static final ISO3166_1Alpha2CountryCode KH = new ISO3166_1Alpha2CountryCode("KH");
395
396        /** Kiribati */
397        public static final ISO3166_1Alpha2CountryCode KI = new ISO3166_1Alpha2CountryCode("KI");
398
399        /** Comoros */
400        public static final ISO3166_1Alpha2CountryCode KM = new ISO3166_1Alpha2CountryCode("KM");
401
402        /** Saint Kitts and Nevis */
403        public static final ISO3166_1Alpha2CountryCode KN = new ISO3166_1Alpha2CountryCode("KN");
404
405        /** Korea (Democratic People's Republic of) */
406        public static final ISO3166_1Alpha2CountryCode KP = new ISO3166_1Alpha2CountryCode("KP");
407
408        /** Korea, Republic of */
409        public static final ISO3166_1Alpha2CountryCode KR = new ISO3166_1Alpha2CountryCode("KR");
410
411        /** Kuwait */
412        public static final ISO3166_1Alpha2CountryCode KW = new ISO3166_1Alpha2CountryCode("KW");
413
414        /** Cayman Islands */
415        public static final ISO3166_1Alpha2CountryCode KY = new ISO3166_1Alpha2CountryCode("KY");
416
417        /** Kazakhstan */
418        public static final ISO3166_1Alpha2CountryCode KZ = new ISO3166_1Alpha2CountryCode("KZ");
419
420        /** Lao People's Democratic Republic */
421        public static final ISO3166_1Alpha2CountryCode LA = new ISO3166_1Alpha2CountryCode("LA");
422
423        /** Lebanon */
424        public static final ISO3166_1Alpha2CountryCode LB = new ISO3166_1Alpha2CountryCode("LB");
425
426        /** Saint Lucia */
427        public static final ISO3166_1Alpha2CountryCode LC = new ISO3166_1Alpha2CountryCode("LC");
428
429        /** Liechtenstein */
430        public static final ISO3166_1Alpha2CountryCode LI = new ISO3166_1Alpha2CountryCode("LI");
431
432        /** Sri Lanka */
433        public static final ISO3166_1Alpha2CountryCode LK = new ISO3166_1Alpha2CountryCode("LK");
434
435        /** Liberia */
436        public static final ISO3166_1Alpha2CountryCode LR = new ISO3166_1Alpha2CountryCode("LR");
437
438        /** Lesotho */
439        public static final ISO3166_1Alpha2CountryCode LS = new ISO3166_1Alpha2CountryCode("LS");
440
441        /** Lithuania */
442        public static final ISO3166_1Alpha2CountryCode LT = new ISO3166_1Alpha2CountryCode("LT");
443
444        /** Luxembourg */
445        public static final ISO3166_1Alpha2CountryCode LU = new ISO3166_1Alpha2CountryCode("LU");
446
447        /** Latvia */
448        public static final ISO3166_1Alpha2CountryCode LV = new ISO3166_1Alpha2CountryCode("LV");
449
450        /** Libya */
451        public static final ISO3166_1Alpha2CountryCode LY = new ISO3166_1Alpha2CountryCode("LY");
452
453        /** Morocco */
454        public static final ISO3166_1Alpha2CountryCode MA = new ISO3166_1Alpha2CountryCode("MA");
455
456        /** Monaco */
457        public static final ISO3166_1Alpha2CountryCode MC = new ISO3166_1Alpha2CountryCode("MC");
458
459        /** Moldova, Republic of */
460        public static final ISO3166_1Alpha2CountryCode MD = new ISO3166_1Alpha2CountryCode("MD");
461
462        /** Montenegro */
463        public static final ISO3166_1Alpha2CountryCode ME = new ISO3166_1Alpha2CountryCode("ME");
464
465        /** Saint Martin (French part) */
466        public static final ISO3166_1Alpha2CountryCode MF = new ISO3166_1Alpha2CountryCode("MF");
467
468        /** Madagascar */
469        public static final ISO3166_1Alpha2CountryCode MG = new ISO3166_1Alpha2CountryCode("MG");
470
471        /** Marshall Islands */
472        public static final ISO3166_1Alpha2CountryCode MH = new ISO3166_1Alpha2CountryCode("MH");
473
474        /** North Macedonia */
475        public static final ISO3166_1Alpha2CountryCode MK = new ISO3166_1Alpha2CountryCode("MK");
476
477        /** Mali */
478        public static final ISO3166_1Alpha2CountryCode ML = new ISO3166_1Alpha2CountryCode("ML");
479
480        /** Myanmar */
481        public static final ISO3166_1Alpha2CountryCode MM = new ISO3166_1Alpha2CountryCode("MM");
482
483        /** Mongolia */
484        public static final ISO3166_1Alpha2CountryCode MN = new ISO3166_1Alpha2CountryCode("MN");
485
486        /** Macao */
487        public static final ISO3166_1Alpha2CountryCode MO = new ISO3166_1Alpha2CountryCode("MO");
488
489        /** Northern Mariana Islands */
490        public static final ISO3166_1Alpha2CountryCode MP = new ISO3166_1Alpha2CountryCode("MP");
491
492        /** Martinique */
493        public static final ISO3166_1Alpha2CountryCode MQ = new ISO3166_1Alpha2CountryCode("MQ");
494
495        /** Mauritania */
496        public static final ISO3166_1Alpha2CountryCode MR = new ISO3166_1Alpha2CountryCode("MR");
497
498        /** Montserrat */
499        public static final ISO3166_1Alpha2CountryCode MS = new ISO3166_1Alpha2CountryCode("MS");
500
501        /** Malta */
502        public static final ISO3166_1Alpha2CountryCode MT = new ISO3166_1Alpha2CountryCode("MT");
503
504        /** Mauritius */
505        public static final ISO3166_1Alpha2CountryCode MU = new ISO3166_1Alpha2CountryCode("MU");
506
507        /** Maldives */
508        public static final ISO3166_1Alpha2CountryCode MV = new ISO3166_1Alpha2CountryCode("MV");
509
510        /** Malawi */
511        public static final ISO3166_1Alpha2CountryCode MW = new ISO3166_1Alpha2CountryCode("MW");
512
513        /** Mexico */
514        public static final ISO3166_1Alpha2CountryCode MX = new ISO3166_1Alpha2CountryCode("MX");
515
516        /** Malaysia */
517        public static final ISO3166_1Alpha2CountryCode MY = new ISO3166_1Alpha2CountryCode("MY");
518
519        /** Mozambique */
520        public static final ISO3166_1Alpha2CountryCode MZ = new ISO3166_1Alpha2CountryCode("MZ");
521
522        /** Namibia */
523        public static final ISO3166_1Alpha2CountryCode NA = new ISO3166_1Alpha2CountryCode("NA");
524
525        /** New Caledonia */
526        public static final ISO3166_1Alpha2CountryCode NC = new ISO3166_1Alpha2CountryCode("NC");
527
528        /** Niger */
529        public static final ISO3166_1Alpha2CountryCode NE = new ISO3166_1Alpha2CountryCode("NE");
530
531        /** Norfolk Island */
532        public static final ISO3166_1Alpha2CountryCode NF = new ISO3166_1Alpha2CountryCode("NF");
533
534        /** Nigeria */
535        public static final ISO3166_1Alpha2CountryCode NG = new ISO3166_1Alpha2CountryCode("NG");
536
537        /** Nicaragua */
538        public static final ISO3166_1Alpha2CountryCode NI = new ISO3166_1Alpha2CountryCode("NI");
539
540        /** Netherlands */
541        public static final ISO3166_1Alpha2CountryCode NL = new ISO3166_1Alpha2CountryCode("NL");
542
543        /** Norway */
544        public static final ISO3166_1Alpha2CountryCode NO = new ISO3166_1Alpha2CountryCode("NO");
545
546        /** Nepal */
547        public static final ISO3166_1Alpha2CountryCode NP = new ISO3166_1Alpha2CountryCode("NP");
548
549        /** Nauru */
550        public static final ISO3166_1Alpha2CountryCode NR = new ISO3166_1Alpha2CountryCode("NR");
551
552        /** Niue */
553        public static final ISO3166_1Alpha2CountryCode NU = new ISO3166_1Alpha2CountryCode("NU");
554
555        /** New Zealand */
556        public static final ISO3166_1Alpha2CountryCode NZ = new ISO3166_1Alpha2CountryCode("NZ");
557
558        /** Oman */
559        public static final ISO3166_1Alpha2CountryCode OM = new ISO3166_1Alpha2CountryCode("OM");
560
561        /** Panama */
562        public static final ISO3166_1Alpha2CountryCode PA = new ISO3166_1Alpha2CountryCode("PA");
563
564        /** Peru */
565        public static final ISO3166_1Alpha2CountryCode PE = new ISO3166_1Alpha2CountryCode("PE");
566
567        /** French Polynesia */
568        public static final ISO3166_1Alpha2CountryCode PF = new ISO3166_1Alpha2CountryCode("PF");
569
570        /** Papua New Guinea */
571        public static final ISO3166_1Alpha2CountryCode PG = new ISO3166_1Alpha2CountryCode("PG");
572
573        /** Philippines */
574        public static final ISO3166_1Alpha2CountryCode PH = new ISO3166_1Alpha2CountryCode("PH");
575
576        /** Pakistan */
577        public static final ISO3166_1Alpha2CountryCode PK = new ISO3166_1Alpha2CountryCode("PK");
578
579        /** Poland */
580        public static final ISO3166_1Alpha2CountryCode PL = new ISO3166_1Alpha2CountryCode("PL");
581
582        /** Saint Pierre and Miquelon */
583        public static final ISO3166_1Alpha2CountryCode PM = new ISO3166_1Alpha2CountryCode("PM");
584
585        /** Pitcairn */
586        public static final ISO3166_1Alpha2CountryCode PN = new ISO3166_1Alpha2CountryCode("PN");
587
588        /** Puerto Rico */
589        public static final ISO3166_1Alpha2CountryCode PR = new ISO3166_1Alpha2CountryCode("PR");
590
591        /** Palestine, State of */
592        public static final ISO3166_1Alpha2CountryCode PS = new ISO3166_1Alpha2CountryCode("PS");
593
594        /** Portugal */
595        public static final ISO3166_1Alpha2CountryCode PT = new ISO3166_1Alpha2CountryCode("PT");
596
597        /** Palau */
598        public static final ISO3166_1Alpha2CountryCode PW = new ISO3166_1Alpha2CountryCode("PW");
599
600        /** Paraguay */
601        public static final ISO3166_1Alpha2CountryCode PY = new ISO3166_1Alpha2CountryCode("PY");
602
603        /** Qatar */
604        public static final ISO3166_1Alpha2CountryCode QA = new ISO3166_1Alpha2CountryCode("QA");
605
606        /** Réunion */
607        public static final ISO3166_1Alpha2CountryCode RE = new ISO3166_1Alpha2CountryCode("RE");
608
609        /** Romania */
610        public static final ISO3166_1Alpha2CountryCode RO = new ISO3166_1Alpha2CountryCode("RO");
611
612        /** Serbia */
613        public static final ISO3166_1Alpha2CountryCode RS = new ISO3166_1Alpha2CountryCode("RS");
614
615        /** Russian Federation */
616        public static final ISO3166_1Alpha2CountryCode RU = new ISO3166_1Alpha2CountryCode("RU");
617
618        /** Rwanda */
619        public static final ISO3166_1Alpha2CountryCode RW = new ISO3166_1Alpha2CountryCode("RW");
620
621        /** Saudi Arabia */
622        public static final ISO3166_1Alpha2CountryCode SA = new ISO3166_1Alpha2CountryCode("SA");
623
624        /** Solomon Islands */
625        public static final ISO3166_1Alpha2CountryCode SB = new ISO3166_1Alpha2CountryCode("SB");
626
627        /** Seychelles */
628        public static final ISO3166_1Alpha2CountryCode SC = new ISO3166_1Alpha2CountryCode("SC");
629
630        /** Sudan */
631        public static final ISO3166_1Alpha2CountryCode SD = new ISO3166_1Alpha2CountryCode("SD");
632
633        /** Sweden */
634        public static final ISO3166_1Alpha2CountryCode SE = new ISO3166_1Alpha2CountryCode("SE");
635
636        /** Singapore */
637        public static final ISO3166_1Alpha2CountryCode SG = new ISO3166_1Alpha2CountryCode("SG");
638
639        /** Saint Helena, Ascension and Tristan da Cunha */
640        public static final ISO3166_1Alpha2CountryCode SH = new ISO3166_1Alpha2CountryCode("SH");
641
642        /** Slovenia */
643        public static final ISO3166_1Alpha2CountryCode SI = new ISO3166_1Alpha2CountryCode("SI");
644
645        /** Svalbard and Jan Mayen */
646        public static final ISO3166_1Alpha2CountryCode SJ = new ISO3166_1Alpha2CountryCode("SJ");
647
648        /** Slovakia */
649        public static final ISO3166_1Alpha2CountryCode SK = new ISO3166_1Alpha2CountryCode("SK");
650
651        /** Sierra Leone */
652        public static final ISO3166_1Alpha2CountryCode SL = new ISO3166_1Alpha2CountryCode("SL");
653
654        /** San Marino */
655        public static final ISO3166_1Alpha2CountryCode SM = new ISO3166_1Alpha2CountryCode("SM");
656
657        /** Senegal */
658        public static final ISO3166_1Alpha2CountryCode SN = new ISO3166_1Alpha2CountryCode("SN");
659
660        /** Somalia */
661        public static final ISO3166_1Alpha2CountryCode SO = new ISO3166_1Alpha2CountryCode("SO");
662
663        /** Suriname */
664        public static final ISO3166_1Alpha2CountryCode SR = new ISO3166_1Alpha2CountryCode("SR");
665
666        /** South Sudan */
667        public static final ISO3166_1Alpha2CountryCode SS = new ISO3166_1Alpha2CountryCode("SS");
668
669        /** Sao Tome and Principe */
670        public static final ISO3166_1Alpha2CountryCode ST = new ISO3166_1Alpha2CountryCode("ST");
671
672        /** El Salvador */
673        public static final ISO3166_1Alpha2CountryCode SV = new ISO3166_1Alpha2CountryCode("SV");
674
675        /** Sint Maarten (Dutch part) */
676        public static final ISO3166_1Alpha2CountryCode SX = new ISO3166_1Alpha2CountryCode("SX");
677
678        /** Syrian Arab Republic */
679        public static final ISO3166_1Alpha2CountryCode SY = new ISO3166_1Alpha2CountryCode("SY");
680
681        /** Eswatini */
682        public static final ISO3166_1Alpha2CountryCode SZ = new ISO3166_1Alpha2CountryCode("SZ");
683
684        /** Turks and Caicos Islands */
685        public static final ISO3166_1Alpha2CountryCode TC = new ISO3166_1Alpha2CountryCode("TC");
686
687        /** Chad */
688        public static final ISO3166_1Alpha2CountryCode TD = new ISO3166_1Alpha2CountryCode("TD");
689
690        /** French Southern Territories */
691        public static final ISO3166_1Alpha2CountryCode TF = new ISO3166_1Alpha2CountryCode("TF");
692
693        /** Togo */
694        public static final ISO3166_1Alpha2CountryCode TG = new ISO3166_1Alpha2CountryCode("TG");
695
696        /** Thailand */
697        public static final ISO3166_1Alpha2CountryCode TH = new ISO3166_1Alpha2CountryCode("TH");
698
699        /** Tajikistan */
700        public static final ISO3166_1Alpha2CountryCode TJ = new ISO3166_1Alpha2CountryCode("TJ");
701
702        /** Tokelau */
703        public static final ISO3166_1Alpha2CountryCode TK = new ISO3166_1Alpha2CountryCode("TK");
704
705        /** Timor-Leste */
706        public static final ISO3166_1Alpha2CountryCode TL = new ISO3166_1Alpha2CountryCode("TL");
707
708        /** Turkmenistan */
709        public static final ISO3166_1Alpha2CountryCode TM = new ISO3166_1Alpha2CountryCode("TM");
710
711        /** Tunisia */
712        public static final ISO3166_1Alpha2CountryCode TN = new ISO3166_1Alpha2CountryCode("TN");
713
714        /** Tonga */
715        public static final ISO3166_1Alpha2CountryCode TO = new ISO3166_1Alpha2CountryCode("TO");
716
717        /** Turkey */
718        public static final ISO3166_1Alpha2CountryCode TR = new ISO3166_1Alpha2CountryCode("TR");
719
720        /** Trinidad and Tobago */
721        public static final ISO3166_1Alpha2CountryCode TT = new ISO3166_1Alpha2CountryCode("TT");
722
723        /** Tuvalu */
724        public static final ISO3166_1Alpha2CountryCode TV = new ISO3166_1Alpha2CountryCode("TV");
725
726        /** Taiwan, Province of China */
727        public static final ISO3166_1Alpha2CountryCode TW = new ISO3166_1Alpha2CountryCode("TW");
728
729        /** Tanzania, United Republic of */
730        public static final ISO3166_1Alpha2CountryCode TZ = new ISO3166_1Alpha2CountryCode("TZ");
731
732        /** Ukraine */
733        public static final ISO3166_1Alpha2CountryCode UA = new ISO3166_1Alpha2CountryCode("UA");
734
735        /** Uganda */
736        public static final ISO3166_1Alpha2CountryCode UG = new ISO3166_1Alpha2CountryCode("UG");
737
738        /** United States Minor Outlying Islands */
739        public static final ISO3166_1Alpha2CountryCode UM = new ISO3166_1Alpha2CountryCode("UM");
740
741        /** United States of America */
742        public static final ISO3166_1Alpha2CountryCode US = new ISO3166_1Alpha2CountryCode("US");
743
744        /** Uruguay */
745        public static final ISO3166_1Alpha2CountryCode UY = new ISO3166_1Alpha2CountryCode("UY");
746
747        /** Uzbekistan */
748        public static final ISO3166_1Alpha2CountryCode UZ = new ISO3166_1Alpha2CountryCode("UZ");
749
750        /** Holy See */
751        public static final ISO3166_1Alpha2CountryCode VA = new ISO3166_1Alpha2CountryCode("VA");
752
753        /** Saint Vincent and the Grenadines */
754        public static final ISO3166_1Alpha2CountryCode VC = new ISO3166_1Alpha2CountryCode("VC");
755
756        /** Venezuela (Bolivarian Republic of) */
757        public static final ISO3166_1Alpha2CountryCode VE = new ISO3166_1Alpha2CountryCode("VE");
758
759        /** Virgin Islands (British) */
760        public static final ISO3166_1Alpha2CountryCode VG = new ISO3166_1Alpha2CountryCode("VG");
761
762        /** Virgin Islands (U.S.) */
763        public static final ISO3166_1Alpha2CountryCode VI = new ISO3166_1Alpha2CountryCode("VI");
764
765        /** Viet Nam */
766        public static final ISO3166_1Alpha2CountryCode VN = new ISO3166_1Alpha2CountryCode("VN");
767
768        /** Vanuatu */
769        public static final ISO3166_1Alpha2CountryCode VU = new ISO3166_1Alpha2CountryCode("VU");
770
771        /** Wallis and Futuna */
772        public static final ISO3166_1Alpha2CountryCode WF = new ISO3166_1Alpha2CountryCode("WF");
773
774        /** Samoa */
775        public static final ISO3166_1Alpha2CountryCode WS = new ISO3166_1Alpha2CountryCode("WS");
776
777        /** Yemen */
778        public static final ISO3166_1Alpha2CountryCode YE = new ISO3166_1Alpha2CountryCode("YE");
779
780        /** Mayotte */
781        public static final ISO3166_1Alpha2CountryCode YT = new ISO3166_1Alpha2CountryCode("YT");
782
783        /** South Africa */
784        public static final ISO3166_1Alpha2CountryCode ZA = new ISO3166_1Alpha2CountryCode("ZA");
785
786        /** Zambia */
787        public static final ISO3166_1Alpha2CountryCode ZM = new ISO3166_1Alpha2CountryCode("ZM");
788
789        /** Zimbabwe */
790        public static final ISO3166_1Alpha2CountryCode ZW = new ISO3166_1Alpha2CountryCode("ZW");
791
792
793        /**
794         * The {@code iso3166_1alpha2-codes.properties} resource.
795         */
796        private static final Properties CODES_RESOURCE = new Properties();
797
798
799        /**
800         * Creates a new ISO 3166-1 alpha-2 country code. Normalises the code
801         * to upper case.
802         *
803         * @param value The country code value, must be two-letter.
804         */
805        public ISO3166_1Alpha2CountryCode(final String value) {
806                super(value);
807                if (value.length() != 2) {
808                        throw new IllegalArgumentException("The ISO 3166-1 alpha-2 country code must be 2 letters");
809                }
810        }
811
812
813        /**
814         * Returns the matching alpha-3 country code. See
815         * {@link ISO3166_1AlphaCountryCodeMapper}.
816         *
817         * @return The matching alpha-3 country code, {@code null} if none.
818         */
819        public ISO3166_1Alpha3CountryCode toAlpha3CountryCode() {
820
821                return ISO3166_1AlphaCountryCodeMapper.toAlpha3CountryCode(this);
822        }
823
824
825        /**
826         * Returns the country name if available in the
827         * {@code iso3166_1alpha2-codes.properties} resource.
828         *
829         * @return The country name, {@code null} if not available.
830         */
831        @Override
832        public String getCountryName() {
833
834                if (CODES_RESOURCE.isEmpty()) {
835                        try (InputStream is = getClass().getClassLoader().getResourceAsStream("iso3166_1alpha2-codes.properties")) {
836                                CODES_RESOURCE.load(is);
837                        } catch (IOException e) {
838                                return null;
839                        }
840                }
841
842                return CODES_RESOURCE.getProperty(getValue());
843        }
844
845
846        @Override
847        public boolean equals(final Object object) {
848
849                return object instanceof ISO3166_1Alpha2CountryCode &&
850                        this.toString().equals(object.toString());
851        }
852
853
854        /**
855         * Parses an ISO 3166-1 alpha-2 (two-letter) country code.
856         *
857         * @param s The string to parse. Must not be {@code null}.
858         *
859         * @return The ISO 3166-1 alpha-2 (two-letter) country code.
860         *
861         * @throws ParseException If parsing failed.
862         */
863        public static ISO3166_1Alpha2CountryCode parse(final String s)
864                throws ParseException {
865
866                try {
867                        return new ISO3166_1Alpha2CountryCode(s);
868                } catch (IllegalArgumentException e) {
869                        throw new ParseException(e.getMessage());
870                }
871        }
872}