diff --git a/src/main/java/com/graphhopper/converter/api/GisgraphySearchEntry.java b/src/main/java/com/graphhopper/converter/api/GisgraphySearchEntry.java index ae77155..dbdea47 100644 --- a/src/main/java/com/graphhopper/converter/api/GisgraphySearchEntry.java +++ b/src/main/java/com/graphhopper/converter/api/GisgraphySearchEntry.java @@ -181,18 +181,14 @@ public void setLabel(String label) { @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("GisgraphySearchEntry [featureId="); - builder.append(featureId); - builder.append(", "); + String stringfeatureId = "GisgraphySearchEntry [featureId="+featureId+", "; + builder.append(stringfeatureId); if (name != null) { - builder.append("name="); - builder.append(name); - builder.append(", "); + String strName = "name=" + name + ", "; + builder.append(strName); } if (isIn != null) { - builder.append("isIn="); - builder.append(isIn); - builder.append(", "); + builder.append("isIn="+isIn+", "); } builder.append("]"); return builder.toString(); diff --git a/src/main/java/com/graphhopper/converter/core/Converter.java b/src/main/java/com/graphhopper/converter/core/Converter.java index 5acc9fb..5991b42 100644 --- a/src/main/java/com/graphhopper/converter/core/Converter.java +++ b/src/main/java/com/graphhopper/converter/core/Converter.java @@ -12,12 +12,11 @@ public class Converter { public static GHEntry convertFromNetToolKitAddress(NetToolKitAddressEntry ntkEntry) { - GHEntry rsp = new GHEntry(null, null, ntkEntry.getLat(), + return new GHEntry(null, null, ntkEntry.getLat(), ntkEntry.getLng(), ntkEntry.getAddress(), null, null, ntkEntry.getCountry(), null, ntkEntry.getCity(), ntkEntry.getState(), null, ntkEntry.getCounty(), ntkEntry.getStreet(), ntkEntry.getHouseNumber(), ntkEntry.getPostalCode(), null); - return rsp; } public static Response convertFromNetToolKitList( @@ -40,21 +39,19 @@ public static Response convertFromNetToolKitList( } public static GHEntry convertFromGisgraphyAddress(GisgraphyAddressEntry gisgraphyEntry) { - GHEntry rsp = new GHEntry(null, null, gisgraphyEntry.getLat(), + return new GHEntry(null, null, gisgraphyEntry.getLat(), gisgraphyEntry.getLng(), gisgraphyEntry.getDisplayName(), null, null, gisgraphyEntry.getCountry(), null, gisgraphyEntry.getCity(), gisgraphyEntry.getState(), null, null, gisgraphyEntry.getStreetName(), gisgraphyEntry.getHouseNumber(), gisgraphyEntry.getZipCode(), null); - return rsp; } public static GHEntry convertFromGisgraphySearch(GisgraphySearchEntry gisgraphyEntry) { - GHEntry rsp = new GHEntry(null, null, gisgraphyEntry.getLat(), + return new GHEntry(null, null, gisgraphyEntry.getLat(), gisgraphyEntry.getLng(), gisgraphyEntry.getLabel(), null, null, gisgraphyEntry.getCountry(), null, gisgraphyEntry.getIsIn(), gisgraphyEntry.getAdm1Name(), null, null, gisgraphyEntry.getName(), gisgraphyEntry.getHouseNumber(), gisgraphyEntry.getZipCode(), null); - return rsp; } public static Response convertFromGisgraphyList( @@ -98,9 +95,8 @@ public static Response convertFromGisgraphySearchList( } public static GHEntry convertFromNominatim(NominatimEntry response) { - GHEntry rsp = new GHEntry(response.getOsmId(), response.getGHOsmType(), response.getLat(), response.getLon(), + return new GHEntry(response.getOsmId(), response.getGHOsmType(), response.getLat(), response.getLon(), response.getDisplayName(), null, response.getType(), response.getAddress(), response.getExtent()); - return rsp; } public static Response convertFromNominatimList(List nominatimResponses, Status status, String locale) { @@ -153,10 +149,8 @@ public static GHEntry convertFromOpenCageData(OpenCageDataEntry response) { } } - GHEntry rsp = new GHEntry(osmId, type, response.getGeometry().lat, response.getGeometry().lng, + return new GHEntry(osmId, type, response.getGeometry().lat, response.getGeometry().lng, response.getFormatted(), null, response.getComponents().type, response.getComponents(), response.getExtent()); - - return rsp; } public static Response convertFromOpenCageData(OpenCageDataResponse ocdRsp, Status status, String locale) { @@ -176,12 +170,11 @@ public static Response convertFromOpenCageData(OpenCageDataResponse ocdRsp, Stat } public static GHEntry convertFromPelias(PeliasEntry response) { - GHEntry rsp = new GHEntry(response.properties.getOsmId(), response.properties.getGHOsmType(), + return new GHEntry(response.properties.getOsmId(), response.properties.getGHOsmType(), response.geometry.getLat(), response.geometry.getLon(), response.properties.name, null, null, response.properties.country, null, response.properties.locality, response.properties.region, response.properties.macrocounty, response.properties.county, response.properties.street, response.properties.housenumber, response.properties.postalcode, response.getExtent()); - return rsp; } public static Response convertFromPelias(PeliasResponse peliasRsp, Status status, String locale) { diff --git a/src/main/java/com/graphhopper/converter/resources/AbstractConverterResource.java b/src/main/java/com/graphhopper/converter/resources/AbstractConverterResource.java index 642cc75..bef2401 100644 --- a/src/main/java/com/graphhopper/converter/resources/AbstractConverterResource.java +++ b/src/main/java/com/graphhopper/converter/resources/AbstractConverterResource.java @@ -19,10 +19,7 @@ abstract class AbstractConverterResource { protected final Logger LOGGER = LoggerFactory.getLogger(this.getClass()); int fixLimit(int limit) { - if (limit > 10) { - return 10; - } - return limit; + return Math.min(limit, 10); } void checkInvalidParameter(boolean reverse, String query, String point) {