Ability to use container class, even when multiplicity is 1

Suggested improvements and new features.

Moderator: Moderators

Ability to use container class, even when multiplicity is 1

Postby Andrew McVeigh » Sat Feb 10, 2001 9:27 am

Currently, the container class for an association end is only used if the multiplicity is > 1.

Is it possible to add an option, so that a container class can be used even with a association end multiplicity of 1? This can be very useful for a number of features, which I outline further below.

Consider the following:

However, with many products (especially database related), they will often use another class to add a level of indirection between the person and car. For example, in TOPLink (an OR mapping tool), the code would look like:

class Person
ValueHolderInterface drives = new ValueHolder(new Car());

However, if I can force the container class to be used (even with the multiplicity set to 1), then I can get this effect by simply setting the container class to be "ValueHolderInterface", and my model still shows an association between Person and Car.

The same effect can be achieved my putting the multiplicity at *, using a container class, and then constraining the multiplicity to be only 1 with OCL, but this is a nuisance.

Another db product that takes this approach is Versant/C++. I can also cite a number of other examples, but I will save you the pain :-)

Andrew McVeigh
London, UK

You do not have the required permissions to view the files attached to this post.
Andrew McVeigh
Posts Rating:

Return to Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests