From e7e2e59f73430436ea929ea8ba7025db055b46ae Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Wed, 21 Apr 2010 00:02:25 +0000 Subject: [PATCH] added missing put methods with TypedKey --- .../google/gson/webservice/definition/ContentBody.java | 1 + .../com/google/gson/webservice/definition/HeaderMap.java | 1 + .../com/google/gson/webservice/definition/ParamMap.java | 8 +++++--- .../google/gson/webservice/definition/RequestBody.java | 9 +++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/wsdef/src/main/java/com/google/gson/webservice/definition/ContentBody.java b/wsdef/src/main/java/com/google/gson/webservice/definition/ContentBody.java index c928f4b4..d1dd6a75 100644 --- a/wsdef/src/main/java/com/google/gson/webservice/definition/ContentBody.java +++ b/wsdef/src/main/java/com/google/gson/webservice/definition/ContentBody.java @@ -30,6 +30,7 @@ class ContentBody extends ParamMap { super(spec, contents); } + @Override public ContentBodySpec getSpec() { return (ContentBodySpec) spec; } diff --git a/wsdef/src/main/java/com/google/gson/webservice/definition/HeaderMap.java b/wsdef/src/main/java/com/google/gson/webservice/definition/HeaderMap.java index f8b983a5..fe4e5c9d 100644 --- a/wsdef/src/main/java/com/google/gson/webservice/definition/HeaderMap.java +++ b/wsdef/src/main/java/com/google/gson/webservice/definition/HeaderMap.java @@ -31,6 +31,7 @@ public final class HeaderMap extends ParamMap { super(spec); } + @Override public Builder put(TypedKey paramKey, T content) { return put(paramKey.getName(), content); } diff --git a/wsdef/src/main/java/com/google/gson/webservice/definition/ParamMap.java b/wsdef/src/main/java/com/google/gson/webservice/definition/ParamMap.java index f2415ff0..d47c0331 100644 --- a/wsdef/src/main/java/com/google/gson/webservice/definition/ParamMap.java +++ b/wsdef/src/main/java/com/google/gson/webservice/definition/ParamMap.java @@ -32,9 +32,6 @@ class ParamMap { /** * If value is a generic type, use {@link #put(String, Object, Type)} instead. - * - * @param key - * @param value */ public Builder put(String paramName, Object content) { return put(paramName, content, content.getClass()); @@ -45,6 +42,11 @@ class ParamMap { contents.put(paramName, content); return this; } + + public Builder put(TypedKey paramKey, K param) { + contents.put(paramKey.getName(), param); + return this; + } } protected final Map contents; diff --git a/wsdef/src/main/java/com/google/gson/webservice/definition/RequestBody.java b/wsdef/src/main/java/com/google/gson/webservice/definition/RequestBody.java index 593921ca..2c24f1aa 100644 --- a/wsdef/src/main/java/com/google/gson/webservice/definition/RequestBody.java +++ b/wsdef/src/main/java/com/google/gson/webservice/definition/RequestBody.java @@ -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 * in the output stream of the request (for example, with * {@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 * {@link com.google.gson.webservice.typeadapters.RequestBodyGsonConverter} * @@ -45,7 +45,12 @@ public final class RequestBody extends ContentBody { public Builder put(String paramName, Object content, Type typeOfContent) { return (Builder) super.put(paramName, content, typeOfContent); } - + + @Override + public Builder put(TypedKey paramKey, T param) { + return (Builder) super.put(paramKey, param); + } + public RequestBody build() { return new RequestBody(spec, contents); }