方法入参用map,请问别人调用怎么办

入参为map ,调用的时候不知道map里面的key到底是什么

 public LocationInfo getProvinceCity(Map<String,String> params 
           ) {
        
        String url = "http://restapi.amap.com/v3/geocode/regeo?location={longitude},{latitude}&key={key}";
   
        ResultAddressInfo resultAddressInfo = httpClient.get(url, params, ResultAddressInfo.class);
  ...
}




 public LocationInfo getProvinceCity(
            BigDecimal longitude,
            BigDecimal latitude) {
        if (Objects.isNull(longitude) || Objects.isNull(latitude)) {
            return new LocationInfo(null, null);
        }

        String url = "http://restapi.amap.com/v3/geocode/regeo?location={longitude},{latitude}&key={key}";

        Map<String, Object> params = new HashMap<>(3);
        params.put("longitude", longitude);
        params.put("latitude", latitude);
        params.put("key", amapConfig.randomKey());

        ResultAddressInfo resultAddressInfo = httpClient.get(url, params, ResultAddressInfo.class);
}

 

posted @ 2018-01-19 15:07  小虾米丶  阅读(186)  评论(0编辑  收藏  举报