mirror of https://github.com/apache/jclouds.git
jenkins api: multimaps.for(map)
This commit is contained in:
parent
fd7c8c06a2
commit
96c98be9fd
|
@ -20,10 +20,9 @@ package org.jclouds.jenkins.v1.binders;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.jclouds.http.utils.ModifyRequest.addQueryParam;
|
import static org.jclouds.http.utils.ModifyRequest.addQueryParams;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
|
@ -32,6 +31,8 @@ import javax.ws.rs.core.UriBuilder;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.rest.Binder;
|
import org.jclouds.rest.Binder;
|
||||||
|
|
||||||
|
import com.google.common.collect.Multimaps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the map to parameters.
|
* Binds the map to parameters.
|
||||||
*
|
*
|
||||||
|
@ -50,9 +51,7 @@ public class BindMapToOptionalParams implements Binder {
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||||
checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Maps!");
|
checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Maps!");
|
||||||
Map<String, String> map = (Map<String, String>) input;
|
Map<String, String> map = (Map<String, String>) input;
|
||||||
for (Entry<String, String> entry : map.entrySet()) {
|
request = addQueryParams(request, Multimaps.forMap(map), builder.get());
|
||||||
request = addQueryParam(request, entry.getKey(), entry.getValue(), builder.get());
|
|
||||||
}
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue