The Artima Developer Community
Sponsored Link

Java Answers Forum
Generic Clone

2 replies on 1 page. Most recent reply: Dec 8, 2002 11:55 AM by Thomas SMETS

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Luiz Eduardo Guida Valmont

Posts: 1
Nickname: valmont
Registered: Dec, 2002

Generic Clone Posted: Dec 5, 2002 11:22 AM
Reply to this message Reply
Advertisement
I?d like to implement the cloning in a class, say Father, and implement it in some way that descendants of the Father class didn?t need to (re)implement it.
    I?ve been venturing through the java.lang.reflect package to find some way of performing a deep cloning by calling the clone method through a Method class, but I guess that wouldn?t suffice. I know that if I implement the clone method in Father in traditional way, I?ll get a "shallow clone". But that?s not enough.
    Does anyone have any idea?

Thanks,
Luiz Eduardo


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Generic Clone Posted: Dec 5, 2002 12:58 PM
Reply to this message Reply
I remember reading about this subject in Josh Bloch's Effective Java book. I don't have it with me and I don't remember all the salient details, but maybe you can find a copy of the book nearby...

Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Generic Clone Posted: Dec 8, 2002 11:55 AM
Reply to this message Reply
Can / could you be more specific Matt or Luis ?

Should the father be capable of providing a cloning for all its children in a transparent way... or even better have a generic cloning factory that would do a deep cloning of any Object given in reference ?
In both case,
I'd like to see the answer 'coze it's a problem that very rarely needs to be solved... but then we usually need it quick :-))

Cheers,

Thomas,

Flat View: This topic has 2 replies on 1 page
Topic: Need coding help Previous Topic   Next Topic Topic: create a batch-file

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use