Article View: borland.public.jbuilder.java.language
Article #15258Setting the parent for Property
From: Pasi Paasiala
Date: Mon, 28 Jun 1999 00:00
Date: Mon, 28 Jun 1999 00:00
19 lines
1387 bytes
1387 bytes
I have the following design problem: I have a package called core that contains classes Entity and Property. These are meant to be used as superclasses in various other packages. An Entity can have zero or more Properties declared as its fields. The problem is that I'd like Property to know the Entity that contains it. I'd refer to this Entity as parent. I have defined a public method setParent to Property. Entity should loop through all its Properties and call this method after the Entity has been created. If I work in the core package this works ok, but when I want to work in another package (e.g. application), Entity cannot access the Properties unless I declare them public. Is there an elegant way to solve this? Currently I see two alternatives: All Properties need to be public or I need to give the Entity in Property's constructor as an argument. Are there any other choises? Pasi
Technical Details
Message-ID:
<7l78ou$llu17@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,edf336d59cb45c77,start X-Google-Attributes: gidf74b3,public From: "Pasi Paasiala" <pasi.paasiala@solibri.com> Subject: Setting the parent for Property Date: 1999/06/28 Message-ID: <7l78ou$llu17@forums.borland.com> X-Deja-AN: 494683529 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language