added missing put methods with TypedKey
This commit is contained in:
parent
00b5d77fa6
commit
e7e2e59f73
|
@ -30,6 +30,7 @@ class ContentBody extends ParamMap {
|
||||||
super(spec, contents);
|
super(spec, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ContentBodySpec getSpec() {
|
public ContentBodySpec getSpec() {
|
||||||
return (ContentBodySpec) spec;
|
return (ContentBodySpec) spec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public final class HeaderMap extends ParamMap {
|
||||||
super(spec);
|
super(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> Builder put(TypedKey<T> paramKey, T content) {
|
public <T> Builder put(TypedKey<T> paramKey, T content) {
|
||||||
return put(paramKey.getName(), content);
|
return put(paramKey.getName(), content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,6 @@ class ParamMap {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If value is a generic type, use {@link #put(String, Object, Type)} instead.
|
* If value is a generic type, use {@link #put(String, Object, Type)} instead.
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
*/
|
||||||
public Builder<T> put(String paramName, Object content) {
|
public Builder<T> put(String paramName, Object content) {
|
||||||
return put(paramName, content, content.getClass());
|
return put(paramName, content, content.getClass());
|
||||||
|
@ -45,6 +42,11 @@ class ParamMap {
|
||||||
contents.put(paramName, content);
|
contents.put(paramName, content);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <K> Builder<T> put(TypedKey<K> paramKey, K param) {
|
||||||
|
contents.put(paramKey.getName(), param);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Map<String, Object> contents;
|
protected final Map<String, Object> contents;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
||||||
* Definition of the request body of a {@link WebServiceCall}. The request body is what is sent out
|
* Definition of the request body of a {@link WebServiceCall}. The request body is what is sent out
|
||||||
* in the output stream of the request (for example, with
|
* in the output stream of the request (for example, with
|
||||||
* {@link java.net.HttpURLConnection#getOutputStream()}) , and is read by the
|
* {@link java.net.HttpURLConnection#getOutputStream()}) , and is read by the
|
||||||
* {@link javax.servlet.http.HttpServletRequest#getInputStream()}.
|
* javax.servlet.http.HttpServletRequest#getInputStream().
|
||||||
* This class omits the default constructor for use by Gson. Instead the user must use
|
* This class omits the default constructor for use by Gson. Instead the user must use
|
||||||
* {@link com.google.gson.webservice.typeadapters.RequestBodyGsonConverter}
|
* {@link com.google.gson.webservice.typeadapters.RequestBodyGsonConverter}
|
||||||
*
|
*
|
||||||
|
@ -46,6 +46,11 @@ public final class RequestBody extends ContentBody {
|
||||||
return (Builder) super.put(paramName, content, typeOfContent);
|
return (Builder) super.put(paramName, content, typeOfContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> Builder put(TypedKey<T> paramKey, T param) {
|
||||||
|
return (Builder) super.put(paramKey, param);
|
||||||
|
}
|
||||||
|
|
||||||
public RequestBody build() {
|
public RequestBody build() {
|
||||||
return new RequestBody(spec, contents);
|
return new RequestBody(spec, contents);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user