🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#7334
From: dnoyeB
Date: Wed, 27 Jun 2001 12:44
32 lines
2371 bytes
Well yea, when its my code.  But this is a bean, and the end user may get
happy and start fiddling around with the innards of the object I pass back.
Its crazy I know, but so is using "private."  Its an ImageIcon, he could
easily replace the image itholds, or set its internal image to null.  My
bean would not like that.  Thats why im considering the copy.  ImageIcon
does not have a copy constructor though...


"John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message
news:MPG.15a34d4ad4cde13a98a2e5@forums.borland.com...
> On Tue, 26 Jun 2001 15:12:10 -0400, "dnoyeB" <lamont_gilbert @
> rigidsoftware.com> wrote:
>
> > HOwever, I am concerned about passing the old object reference
> > into this event to be handed around and molested/violated.  I
> > would prefer to pass a copy of the object, but is this proper?
>
> I do not think you have to create a copy, but there is no reason that
> it would not work.  Well behaved code should probably not be changing
> the objects passed to it in a property change notification, so I do not
> think it is really necessary in most cases.  Depending on how many such
> events are generated, it could become a performance issue if you copy
> the object.
>
> --
> Regards,
>
> John McGrath [TeamB]
>
> ---------------------------------------------------
> Before sending me e-mail, please read:
>     http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <3b39da81$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b38df5b$3_1@dnews> <MPG.15a34d4ad4cde13a98a2e5@forums.borland.com>

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-27 06:10:55 PST
From: "dnoyeB" <lamont_gilbert @ rigidsoftware.com>
Newsgroups: borland.public.jbuilder.java.language
References: <3b38df5b$3_1@dnews> <MPG.15a34d4ad4cde13a98a2e5@forums.borland.com>
Subject: Re: firing property change events:  use copies or originals?
Date: Wed, 27 Jun 2001 08:44:52 -0400
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 63.68.196.49
Message-ID: <3b39da81$1_1@dnews>
X-Trace: dnews 993647233 63.68.196.49 (27 Jun 2001 06:07:13 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews