Re: Cloning Form Beans

2003-06-12 Thread Paul Curren
Hi there, I don't know the answer but reading the javadoc on cloneBean it states - Clone a bean based on the available getters and setters... So if the getter on your bean isn't making defensive copies (and neither is the setter) then i'd imagine your newly cloned bean will have properties that

RE: Cloning Form Beans

2003-06-12 Thread Jerry Jalenak
] -Original Message- From: Paul Curren [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 12:19 PM To: Struts Users Mailing List Subject: Re: Cloning Form Beans Hi there, I don't know the answer but reading the javadoc on cloneBean it states - Clone a bean based on the available

Re: Cloning Form Beans

2003-06-12 Thread Erik Price
Jerry Jalenak wrote: Not sure what you mean by 'defensive copies' Is there something special I need to do in my bean so I end up with a 'true' duplicate, and not just a second reference? Defensive copies... described in Josh Bloch's Effective Java. Getter methods return a copy of the

RE: Cloning Form Beans

2003-06-12 Thread Jerry Jalenak
Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 12:39 PM To: Struts Users Mailing List Subject: Re: Cloning Form Beans Jerry Jalenak wrote

RE: Cloning Form Beans

2003-06-12 Thread Derek Richardson
Don't you mean required for immutable classes that are ***composed by*** other objects which are mutable? -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 1:39 PM To: Struts Users Mailing List Subject: Re: Cloning Form Beans Jerry

Re: Cloning Form Beans

2003-06-12 Thread Erik Price
Jerry Jalenak wrote: So, something like this? private String myString; public String getMyString() { String returnedString = this.myString; return (returnedString); } I'm not sure how this applies to my cloning issue Well, String

Re: Cloning Form Beans

2003-06-12 Thread Erik Price
Erik Price wrote: But you're still not safe yet. What if somehow someone had held onto a reference to one of the Date objects passed into the constructor? Date myEvilStart = new Date(); Date end = new Date(); Period p = new Period(myEvilStart, end); // at this point is p immutable?

RE: Cloning Form Beans

2003-06-12 Thread Jerry Jalenak
Price [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:12 PM To: Struts Users Mailing List Subject: Re: Cloning Form Beans Erik Price wrote: But you're still not safe yet. What if somehow someone had held onto a reference to one of the Date objects passed into the constructor

Re: Cloning Form Beans

2003-06-12 Thread Erik Price
Jerry Jalenak wrote: Erik, Thanks for the lesson - and I'll get out and get a copy of Josh's book. In the meantime I've also discovered that 'clone' basically does a shallow copy - i.e. if there is a nested construct of javabeans, clone will only copy the hightest level, and then place