深入克隆客户端的一个对象(GWT + Javascript)? [英] Deep Cloning an object on the client side (GWT + Javascript) ?

查看:133
本文介绍了深入克隆客户端的一个对象(GWT + Javascript)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Java中的深度克隆库,这是我在服务器端代码中使用的。然而,现在我需要在客户端代码中深层克隆一个对象。我相信有一个Javascript框架可以完成YUI3这个功能,但是我不知道如何在我的GWT代码中使用它。

解决方案

您可以使用 JSNI 使用GWT代码中的YUI3代码,但是您必须将整个YUI3源代码包含在您的GWT应用程序中,如果您只需要深度克隆功能。

如果您拥有用于java后端的深度克隆库的源代码,那么如果没有外部依赖关系,您也可以在GWT客户端上使用它。

You可以检查出这些资源的更多信息:





GWT叠加深度复制


I know of a Deep Cloning library in Java, which I use in my server side code.

However, right now I need to "deep clone" an object on the client side code. I believe there's a Javascript framework that does this thing which is YUI3, however I am not sure how to use this with my GWT code.

解决方案

You could use JSNI to use YUI3 code from GWT Code, however you would have to include the whole YUI3 source in your GWT app which might be a litle bit inefficient if you only need the deep cloning functionality.
If you have the the source code for the deep cloning library for your java backend you might use it also on the GWT client if there are no external dependencies.
You can check out also these resources for more info:

How can I deep copy an arbitrary object in GWT?
GWT Overlay deep copy

这篇关于深入克隆客户端的一个对象(GWT + Javascript)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆