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.
This commit is contained in:
Alan Orth 2020-08-01 00:02:27 +03:00
parent edd08c859a
commit 6995d7a864
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -30,21 +30,21 @@ public class CountriesVocabulary {
private String commonName; //optional private String commonName; //optional
private String officialName; //optional private String officialName; //optional
private String numeric; //required Hmmmm need to cast this... private String numeric; //required Hmmmm need to cast this...
private String alpha2; //required private String alpha_2; //required
private String alpha3; //required private String alpha_3; //required
public Country(String name, public Country(String name,
@Nullable String commonName, @Nullable String commonName,
@Nullable String officialName, @Nullable String officialName,
String numeric, String numeric,
String alpha2, String alpha_2,
String alpha3) { String alpha_3) {
this.name = name; this.name = name;
this.commonName = commonName; this.commonName = commonName;
this.officialName = officialName; this.officialName = officialName;
this.numeric = numeric; // fuuuuu this is a string and we can't cast to Integer because some values are zeropadded like "004" this.numeric = numeric; // fuuuuu this is a string and we can't cast to Integer because some values are zeropadded like "004"
this.alpha2 = alpha2; this.alpha_2 = alpha_2;
this.alpha3 = alpha3; this.alpha_3 = alpha_3;
} }
public String getName() { public String getName() {
@ -63,12 +63,12 @@ public class CountriesVocabulary {
return officialName; return officialName;
} }
public String getAlpha2() { public String getAlpha_2() {
return alpha2; return alpha_2;
} }
public String getAlpha3() { public String getAlpha_3() {
return alpha3; return alpha_3;
} }
} }
} }