diff options
Diffstat (limited to 'src/org/traccar/geocode/GoogleReverseGeocoder.java')
-rw-r--r-- | src/org/traccar/geocode/GoogleReverseGeocoder.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/org/traccar/geocode/GoogleReverseGeocoder.java b/src/org/traccar/geocode/GoogleReverseGeocoder.java index ade49a38b..ca1d42000 100644 --- a/src/org/traccar/geocode/GoogleReverseGeocoder.java +++ b/src/org/traccar/geocode/GoogleReverseGeocoder.java @@ -30,7 +30,7 @@ public class GoogleReverseGeocoder extends JsonReverseGeocoder { } @Override - protected Address parseAddress(JsonObject json) { + public Address parseAddress(JsonObject json) { JsonArray results = json.getJsonArray("results"); if (!results.isEmpty()) { @@ -43,35 +43,31 @@ public class GoogleReverseGeocoder extends JsonReverseGeocoder { String value = component.getString("short_name"); - for (JsonString type : component.getJsonArray("types").getValuesAs(JsonString.class)) { + typesLoop: for (JsonString type : component.getJsonArray("types").getValuesAs(JsonString.class)) { switch (type.getString()) { case "street_number": address.setHouse(value); - break; + break typesLoop; case "route": address.setStreet(value); - break; + break typesLoop; case "locality": address.setSettlement(value); - break; + break typesLoop; case "administrative_area_level_2": address.setDistrict(value); - break; + break typesLoop; case "administrative_area_level_1": address.setState(value); - break; + break typesLoop; case "country": address.setCountry(value); - break; + break typesLoop; case "postal_code": address.setPostcode(value); - break; - default: - continue; + break typesLoop; } - - break; } } |