if (latlng == null) {
latlng = endpoint.getLatlng();
}
if (latlng != null) {
GeocoderRequest req = new GeocoderRequest();
req.setLanguage(endpoint.getLanguage());
String lat = ObjectHelper.before(latlng, ",");
String lng = ObjectHelper.after(latlng, ",");
req.setLocation(new LatLng(lat, lng));
LOG.debug("Geocode for lat/lng {}", latlng);
GeocodeResponse res = geocoder.geocode(req);
LOG.debug("Geocode response {}", res);
if (res != null) {
extractGeoResult(res, exchange);
}
} else if (address != null) {
// is it current address
if ("current".equals(address)) {
processCurrentLocation(exchange);
} else {
LOG.debug("Geocode for address {}", address);
GeocoderRequest req = new GeocoderRequest(address, endpoint.getLanguage());
GeocodeResponse res = geocoder.geocode(req);
LOG.debug("Geocode response {}", res);
if (res != null) {
extractGeoResult(res, exchange);