Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 68083 invoked from network); 28 Oct 2002 06:49:47 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 28 Oct 2002 06:49:47 -0000 Received: (qmail 3039 invoked by uid 97); 28 Oct 2002 06:50:46 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 2994 invoked by uid 97); 28 Oct 2002 06:50:44 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 2982 invoked by uid 98); 28 Oct 2002 06:50:44 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: Mon, 28 Oct 2002 07:49:44 +0100 (MET) From: Victor Volle To: "Jakarta Commons Developers List" MIME-Version: 1.0 References: <01a901c27e27$53995fe0$0200a8c0@GATEWAY> Subject: Re: [clazz] Type-based or instance-based metadata? Take II X-Priority: 3 (Normal) X-Authenticated-Sender: #0004067401@gmx.net X-Authenticated-IP: [145.254.236.148] Message-ID: <11837.1035787784@www1.gmx.net> X-Mailer: WWW-Mail 1.5 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > a) We introduce all those methods suggested by Victor Volle: It was never meant as a suggestion but rather as a "beware" :-) > boolean isIndexed(); > boolean isMapped(); > boolean isListed(); // I would call it "isUnorderedCollection" > > we keep all access methods and throw an exception when the wrong one is > called. > > > b) We follow what I think is Berin's suggestion (admittedly I don't always > understand them - I am not a native speaker of English, C# and Avalon), > > Anyway, my understanding is that the idea is to have these methods: > > field.getAttributeMethod(), // Type based > field.getAttributeMethod(Object instance) // Instance based > > which return one of the following > BasicAttributeMethod > IndexedAttributeMethod > MappedAttributeMethod > UnorderedCollectionAttributeMethod > IterationAttributeMethod > > (names would have to be fixed up) > > Each of these would have methods specific to the corresponding way of > manipulating the attribute. For example, > > class BasicAttributeMethod { > Object get(Object instance); > void set(Object instance, Object value); > Object setNew(Object instance, Clazz clazz, Object[] parameters); > } > > class IndexedAttributeMethod { > int getSize(Object instance); > Object get(Object instance, int index); > void set(Object instance, int index, Object value); > Object setNew(Object instance, int index, Clazz clazz, Object[] > parameters); > } > > etc. > > I think (b) is the nicer of the two appoaches. that would mean calling "instanceof". I do not like either solution. Anyway, I would also tend to solution b) if we throw in the method add() for Indexed and (Un)orderedCollection. (Lists are not unordered, Sets are. What about CollectionAttribute and make IndexedAttribute a subclass?) Victor -- To unsubscribe, e-mail: For additional commands, e-mail: