Page 1 of 1

Exclusive Collections

Posted: Fri Aug 07, 2009 11:15 am
by ConvertFromOldNGs
by Craig Shearer >> Fri, 6 Aug 1999 10:37:06 GMT

Hi Everybody

I'm interested in opinions on the following...

JADE has a concept of exclusive collections meaning that you have a collection which "belongs" to one object only and cannot be shared with other objects. In practise this means that you can pass the reference to the collection around as a parameter to a method, but you can never store this reference on another object, quite simply because it's not shared!

However, this does present some practical problems... quite often it would be useful to be able to pass an exclusive collection to an form, then have several methods on that form work on the collection. Rather than having to keep passing the collection around, if you could store it on the form, it would be much more convenient.

What I'm proposing is that there be the facility to allow transients to store references to persistent exclusive collections. This would be useful for generic forms that process any collection. You could then set the collection reference on the form, without having to either call methods on the form directly (and consequently pass the collection to the methods) or provide some means for the form to get at the reference (by providing a reference on the form on which a method can be called to obtain a reference to the collection). This would reduce coupling between classes, which is always desirable.

Actually, there is a workaround for this problem if you're interested...

If you want to be able to get access to an exclusive collection and effectively store the reference, just create an iterator for the collection, then store this iterator. Then, when you want to get at the collection reference, you can call iterator.getCollection. Bit of a hack, but it works :-)

Comments?

Craig.

Re: Exclusive Collections

Posted: Fri Aug 07, 2009 11:15 am
by ConvertFromOldNGs
by Paul Mathews >> Sat, 7 Aug 1999 13:42:31 GMT

Craig thats what we are using string.asOid for, a previous discussion
to which you and Dean Cooper added to, i.e.

2) Another great use is it enables an exclusive collection to be store
as a string property to be used later.