Tuesday, December 6, 2011

Re: Object deep copy or serialization

I think you only have the standard options:

- Use the Editor Framework of GWT (using it you would have to call a flush() method that writes changes to your object. If a user hits cancel you just won't call flush() -> no need for cloning)
- You could implement Object.clone(), implement a custom .copy() method or use copy constructors.
- If you want to traverse your object graph more often for different purposes, it may be a good idea to implement the visitor pattern and then implement a CreateCopyVisitor.

Currently I can only think of GWT's AutoBean Framework which supports cloning "out of the box" using the AutoBeanUtils class, e.g. AutoBeanUtils.decodeInto(AutoBeanUtils.encode(autobean), newAutoBean). But that would require that your objects are AutoBeans.


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/KXDkxcEyGRYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate