Revision: 7769
Author: [email protected]
Date: Tue Mar 23 09:22:21 2010
Log: Use instance methods on a JSO instead of static methods.
Patch by: amitmanjhi
Review by: rjrjr (desk review)
http://code.google.com/p/google-web-toolkit/source/detail?r=7769
Modified:
/trunk/bikeshed/src/com/google/gwt/requestfactory/client/gen/ClientRequestObject.java
=======================================
---
/trunk/bikeshed/src/com/google/gwt/requestfactory/client/gen/ClientRequestObject.java
Mon Mar 22 16:05:18 2010
+++
/trunk/bikeshed/src/com/google/gwt/requestfactory/client/gen/ClientRequestObject.java
Tue Mar 23 09:22:21 2010
@@ -25,30 +25,28 @@
*/
public class ClientRequestObject {
+ private static class MyJSO extends JavaScriptObject {
+ static native MyJSO create() /*-{
+ return {};
+ }-*/;
+
+ protected MyJSO() {
+ }
+
+ private native void put(String key, String value)/*-{
+ this[key] = value;
+ }-*/;
+
+ private native String toJsonString()/*-{
+ return JSON.stringify(this);
+ }-*/;
+ }
+
public static String getRequestString(Map<String, String> requestData) {
- ClientRequestObject requestObject = new ClientRequestObject();
- requestObject.init();
+ MyJSO requestObject = MyJSO.create();
for (String key : requestData.keySet()) {
requestObject.put(key, requestData.get(key));
}
return requestObject.toJsonString();
}
-
- private JavaScriptObject map;
-
- ClientRequestObject() {
- init();
- }
-
- private native void init()/*-{
-
th...@com.google.gwt.requestfactory.client.gen.clientrequestobject::map =
{};
- }-*/;
-
- private native void put(String key, String value)/*-{
-
th...@com.google.gwt.requestfactory.client.gen.clientrequestobject::map[key]
= value;
- }-*/;
-
- private native String toJsonString()/*-{
- return
JSON.stringify(th...@com.google.gwt.requestfactory.client.gen.clientrequestobject::map);
- }-*/;
-}
+}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
To unsubscribe from this group, send email to
google-web-toolkit-contributors+unsubscribegooglegroups.com or reply to this email with
the words "REMOVE ME" as the subject.