Refactored Pairs to use List instead of Set.

This commit is contained in:
Raghav Sidhanti
2015-06-22 17:14:18 -07:00
parent 32b50e7c8e
commit 6958db3d3d
22 changed files with 83 additions and 87 deletions

View File

@@ -59,7 +59,7 @@ public class {{classname}} {
String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{paramName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
// query params
Set<Pair> queryParams = new HashSet<Pair>();
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params

View File

@@ -23,8 +23,7 @@ import java.util.Collection;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.util.ArrayList;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -137,8 +136,8 @@ public class ApiInvoker {
/*
Format to {@code Pair} objects.
*/
public static Set<Pair> parameterToPairs(String collectionFormat, String name, Object value){
Set<Pair> params = new HashSet<Pair>();
public static List<Pair> parameterToPairs(String collectionFormat, String name, Object value){
List<Pair> params = new ArrayList<Pair>();
// preconditions
if (name == null || name.isEmpty()) return params;
@@ -247,7 +246,7 @@ public class ApiInvoker {
}
}
public String invokeAPI(String host, String path, String method, Set<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
public String invokeAPI(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
HttpClient client = getClient(host);
StringBuilder b = new StringBuilder();