Commit Graph

10 Commits

Author SHA1 Message Date
6995d7a864
Match alpha_2 and alpha_3 JSON elements with class
For GSON to automatically map these to our class we need to make
sure they use the same name.
2020-08-01 00:02:27 +03:00
edd08c859a
CountryCodeTagger.java: Remove FileReader import
We are using an InputStream now.
2020-07-31 23:37:06 +03:00
94ceabb732
Close BufferedReader after we use it 2020-07-31 22:26:50 +03:00
9089ffb66f
Add TODO about using try-with-resource
This would automatically close the BufferedReader after we are done
with it, but it also means that the JSON object we create is lost
when we exit the try() scope...

See: https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
2020-07-31 22:26:33 +03:00
af708933b2
Use BufferedReader for iso-codes JSON 2020-07-31 22:25:09 +03:00
d11bd00fa9
Use country vocabs from package resources
Import a local copy of iso_3166-1.json from iso-codes version 4.5.0
so we don't need to load it from the system.

See: https://salsa.debian.org/iso-codes-team/iso-codes
2020-07-31 22:18:32 +03:00
4cf0626385
Update comments 2020-07-31 22:00:41 +03:00
f62b50f5a1
Use the @SerializedName annotation for ISO 3166-1
Our Java class needs to match the input JSON structure exactly, but
we can't use "3166-1" as a variable name so we tell GSON to use the
name "3166-1" when deserializing to countries.
2020-07-31 21:52:48 +03:00
968bd354fe
Optimize imports 2020-07-31 21:42:41 +03:00
89f1734a9a
Initial commit 2020-07-31 21:40:15 +03:00