--- Victor Volle <[EMAIL PROTECTED]> wrote: > > 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. I know...
> 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?) Sure. > Victor - Dmitri __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ -- To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>