🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7323

Re: firing property change events: use copies or originals?

#7323
From: Torsten Welches
Date: Wed, 27 Jun 2001 05:24
23 lines
1737 bytes
"dnoyeB" <lamont_gilbert @ rigidsoftware.com> wrote:

>I would prefer to pass a copy of the object, but is this 
>proper?  Am I just paranoid? Which is the correct thing to 
>pass, the original object the events are firing about, or 
>copies?

There's nothing in the documentation that implies handing out 
clones would be improper. It merely says:
"the old value for the property, expressed as an Object"

I don't think there is a correct and an incorrect way. It
totally depends on what your application is doing, whether it 
really would be dangerous to "use" the old value object and so 
on. A receiver of a PropertyChangeEvent knows that the old value
no longer is valid, he/she probably wouldn't care to change it 
anyway. 
And then comes paranoia... <g>

If you do pass a clone you should document it IMO.

Torsten
Technical Details
Message-ID: <3b396e15$2_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3b38df5b$3_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,88b4b8db5c548e01
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-26 22:37:22 PST
From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Subject: Re: firing property change events:  use copies or originals?
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 193.158.55.74 193.158.55.74    
References:  <3b38df5b$3_1@dnews> 
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3b396e15$2_2@dnews>
Date: 26 Jun 2001 22:24:37 -0700
X-Trace: dnews 993619477 207.105.83.65 (26 Jun 2001 22:24:37 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews