com.sigopt.net.ParamsBuilder Maven / Gradle / Ivy
package com.sigopt.net;
import com.sigopt.model.APIObject;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
class ParamsBuilder {
public static Map build(Map params) {
Map ret = new HashMap();
params = MapHelper.ensure(params);
for (Map.Entry entry: params.entrySet()) {
if (entry.getValue() == null) { continue; }
if (entry.getValue() instanceof APIObject) {
ret.put(entry.getKey(), APIObject.toJson(entry.getValue()));
} else {
ret.put(entry.getKey(), entry.getValue().toString());
}
}
return ret;
}
}