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 referenc
---Original Message-
From: Erik 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 o
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?
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 it
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
, Web 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:
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 pro
96
[EMAIL PROTECTED]
-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
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 tha
Hi All,
I have a form-bean defined in struts-config that is created in session scope
in a setup action, then used in another three actions (kinda of a wizard
thing). In the second action I have to make an exact copy of the form bean
so I can do some comparisons between old and new values. I init
10 matches
Mail list logo