Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 89226 invoked from network); 29 Oct 2002 01:02:39 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 29 Oct 2002 01:02:39 -0000 Received: (qmail 11560 invoked by uid 97); 29 Oct 2002 01:03:34 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 11544 invoked by uid 97); 29 Oct 2002 01:03:34 -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 11527 invoked by uid 98); 29 Oct 2002 01:03:33 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <010101c27ee6$f98954e0$6d4029d9@oemcomputer> From: "Stephen Colebourne" To: "Jakarta Commons Developers List" Subject: [clazz] Accessing the properties Date: Tue, 29 Oct 2002 01:03:20 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N (I'll use the terms property and metaproperty in this email as per the checked in CVS) On the Joda project I created a subinterface and subclass for each basic type. Thus a StringProperty is a subinterface of Property that makes it specific to a String. It adds a lot of type safety, but is a bit of a pain. (Lots of classes in the API, lots to maintain, there's always a class not covered). However, for Lists and Maps it works well to have subinterfaces. Thus I propose: Property - get() and set(Object) ListProperty - extends List MapProperty - extends Map (This is instead of IndexedAttributeAccessor/MappedAttributeAccessor) The trick is to re-use the List and Map interfaces, rather than redefining our own pale imitations using a few add/set/remove methods. In java reflection the code is field.get(Object instance) For the MetaProperty concept I would change this to: metaProperty.getProperty(instance).get(); Thus the getProperty() method returns a suitable wrapper for that property for that instance. ie. it creates the delegate. Thus at the meta level, there is no need for specific List and Map subinterfaces. I think the key to all APIs like this is to re-use what Java offers, and thats the collections API in this case. Stephen -- To unsubscribe, e-mail: For additional commands, e-mail: