commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject [clazz] Accessing the properties
Date Tue, 29 Oct 2002 01:03:20 GMT
(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

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:

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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message