Before I start to rely on this, I wanted to know if this is a valid
technique for cloning a JavaScriptObject and whether there are any
limitations I might run into.

The situation is that I'd like to clone a 'settings' object so
instances of this class I build using it are immutable. I understand
it's not a deep clone, but I don't think it's necessary in my case.

  private static JavaScriptObject cloneJSO(JavaScriptObject src) {
    JSONObject srcObj = new JSONObject(src);
    JSONObject dstObj = new JSONObject();
    for (String key : srcObj.keySet()) {
      dstObj.put(key, srcObj.get(key));
    }
    return dstObj.getJavaScriptObject();
  }

Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to