aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-13 22:38:13 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-13 22:38:13 +1200
commitabb2f8614b7fbc25892e277b55fa216c7d81fd54 (patch)
treefea9e46e90d734c8052d81120c65fd50f492ee30 /src/org/traccar/Context.java
parent8e033d5d4efa6a88f25e86517f858b696b76546c (diff)
downloadtrackermap-server-abb2f8614b7fbc25892e277b55fa216c7d81fd54.tar.gz
trackermap-server-abb2f8614b7fbc25892e277b55fa216c7d81fd54.tar.bz2
trackermap-server-abb2f8614b7fbc25892e277b55fa216c7d81fd54.zip
Use switch statemens with strings
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 0b74eacd0..707e6edb6 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -103,14 +103,18 @@ public class Context {
}
if (config.getBoolean("geocoder.enable")) {
- String type = config.getString("geocoder.type");
+ String type = config.getString("geocoder.type", "google");
String url = config.getString("geocoder.url");
- if (type != null && type.equals("nominatim")) {
- reverseGeocoder = new NominatimReverseGeocoder(url);
- } else if (type != null && type.equals("gisgraphy")) {
- reverseGeocoder = new GisgraphyReverseGeocoder(url);
- } else {
- reverseGeocoder = new GoogleReverseGeocoder();
+ switch (type) {
+ case "google":
+ reverseGeocoder = new GoogleReverseGeocoder();
+ break;
+ case "nominatim":
+ reverseGeocoder = new NominatimReverseGeocoder(url);
+ break;
+ case "gisgraphy":
+ reverseGeocoder = new GisgraphyReverseGeocoder(url);
+ break;
}
}