On Thu, Oct 2, 2008 at 10:30 PM, Bernd Fondermann <
[EMAIL PROTECTED]> wrote:

> I'd prefer a copy constructor, or a CopyUtil.
> Please consider 
> http://en.wikipedia.org/wiki/Clone_(Java_method)<http://en.wikipedia.org/wiki/Clone_%28Java_method%29>


Under different circumstances I would agree with you. But in this case it
does not seem applicable to me because a) only concrete classes can have a
copy constructor and b) a CopyUtil class would require a visitor.

regarding a: Body is an interface - how do you copy Body instances with a
copy constructor?
regarding b: like I said, the set of classes is open for expansion. As I see
it it should be possible to implement the Body interface in a different way.

Maybe a hybrid form would be acceptable? Meaning either a copy constructor
or a visitor for top-level classes such as Message, Multipart and BodyPart
in addition to a copy-method declared in the Body interface..

Markus

Reply via email to