Thanks for reply @Thomas Broyer and @Jens @Jens thanks for sharing good example and technique for making copy of object.
Thanks & Regards, Bhumika On Fri, Jul 12, 2013 at 3:04 PM, Jens <[email protected]> wrote: > You can emulate CloneNotSupportedException yourself to make the GWT > compiler happy. The only thing that you do not have in GWT is > Object.clone() as its not implemented by GWT. This means you do not get a > copy of an instance if you call super.clone() in one of your top level > classes. In GWT trunk I think you will get an exception now when you call > Object.clone(). > > In general I would never really use clone() of Java. Instead I define my > own interface and use it to replicate clone(). > > Example: > > interface Copyable<T> { > T copy(); > T deepCopy(); > } > > class Person implements Copyable<Person> { > String name; > Person friend; > > protected Person(Person other, boolean deep) { > // super(other, deep) if Person would extend HumanBeing or similar. > name = other.name; > friend = other.friend; > if(deep) { > friend = friend.deepCopy(); > } > } > > public Person copy() { > return new Person(this, false); > } > > public Person deepCopy() { > return new Person(this, true); > } > } > > -- J. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Google Web Toolkit" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/google-web-toolkit/8tgvSPOODH0/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-web-toolkit. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
