Any ways/workarounds/tools/tricks to emulate/fake/etc. Object.clone?

11 views
Skip to first unread message

John Gunther

unread,
Sep 4, 2007, 11:31:23 AM9/4/07
to Google Web Toolkit
What I'm trying to do would be easy if there were an Object.clone
method in GWT but there isn't.

Wondering if anyone has any insights on alternative ways (or
alternatives to) object.clone in GWT?

Reinier Zwitserloot

unread,
Sep 4, 2007, 4:06:00 PM9/4/07
to Google Web Toolkit
None. Without clone() and without reflection, it is completely
impossible. Each object you want to clone needs to be of a type that
implements its own clone manually.

Axel Kittenberger

unread,
Sep 4, 2007, 6:14:24 PM9/4/07
to Google Web Toolkit
The gwt-compiler does now all the fields an object will have.
So clone() would be implementable at GWT on compiler level special
issue function. The compiler ""just"" would have to generate a
function for every object where it is called doing all the cloning
explicitly in javascript.

Make it a feature request maybe?

Peter Blazejewicz

unread,
Sep 5, 2007, 11:09:04 PM9/5/07
to Google Web Toolkit
hi John,
as other alternative try using Prototype.js library Object.clone()
method:
http://www.prototypejs.org/api/object/clone
not being sure how it will work thouh (never tried myself),
regards,
Peter

Reply all
Reply to author
Forward
0 new messages