Specify aggregation generated type?

Hello forum -

Due to a lack of documentation on UML to code mapping (see this bug http://www.netbeans.org/issues/show_bug.cgi?id=79555), I am having to learn by trial and error.

I would like to model an aggregation that is translated into a HashMap. Now, I see that I can change the UML generation options and specify that collections are mapped to java.util.ArrayList or java.util.HashMap types, but I would like to specify the resulting type on a case-by-case basis and not on the entire project.

Is there a way to do this that I am not seeing?

[573 byte] By [ambrosia08a] at [2007-11-27 2:22:15]
# 1

I hope I am understanding your question...

If you are working with 5.5 or prior, the feature is very limitied. There is a 5.5 patch in the work for UML (should be on Update Center soon) that will have a more robust feature that is implemented in NB6.

If you are using latest NB6.0, there is a new property that has been added for multiplicities. Let's look at an attribute on a class element. If the attribute has multiplicity:

public String foo[*, *]

and in this case more than one range (dimension), the default is to generate "As Array". To customize this, select the attribute, click on the Multiplicity property. In the custom editor, you will see that the ranges table has a Collection Type column. You can select a "well-known" Collection type or you can manually type your custom Collection Type, but be sure to fully qualify it so that code gen will add the proper import statements. You can use a different Collection type for every attribute as well as for each individual range of the attribute.

This works for parameters as well. Return Types may not have this feature implemented yet, but it will be there soon.

I suspect what you are asking may not be exactly what I described, but thought it might be related and at the very least, helpful in other areas for you.

craig

cvconovera at 2007-7-12 2:26:02 > top of Java-index,Development Tools,Java Tools...