@Override public String parseQueryParams(String path, Map<Integer, String> queryParams, Object[] args) throws UnsupportedEncodingException { if (queryParams.size() > 0) { path += path.contains("?") ? "&" : "?"; List<String> vals = new ArrayList<String>(); for (Map.Entry<Integer, String> queryParamEntry : queryParams.entrySet()) { Object paramVal = args[queryParamEntry.getKey()]; if (paramVal != null) { String value = Uri.encode(paramVal.toString()); vals.add(String.format("%s=%s", queryParamEntry.getValue(), value)); } } path = path + StringUtils.join(vals.toArray(), "&"); } return path; }
@Override @SuppressWarnings("unchecked") public String parseBundledQueryParams(String path, Object object) throws UnsupportedEncodingException { if (object != null) { path += path.contains("?") ? "&" : "?"; Map<String, Object> props = mapper.convertValue(object, Map.class); List<String> vals = new ArrayList<String>(); for (Map.Entry<String, Object> queryParamEntry : props.entrySet()) { if (queryParamEntry.getValue() != null) { String value = Uri.encode(queryParamEntry.getValue().toString()); vals.add(queryParamEntry.getKey() + "=" + value); } } path = path + StringUtils.join(vals.toArray(), "&"); } return path; }