Page 1 of 1

Treat the "Container" language property like any other class reference when generating code.

PostPosted: Thu Feb 21, 2002 3:22 pm
by Jim Mayer
I'm not sure whether this is an enhancement request or a bug report.

Environment
--------------

I'm using MagicDraw UML 5.0 SP1.

The Problem
---------------

If I create a unidirectional association from "myclass" to
"java.util.HashMap" with unspecified cardinality, and if I have "automatic
import generation" selected, then MagicDraw will generate code that looks
like this:

------------------------------------
import java.util.HashMap;

/**
*/
public class MyContainer
{
/**
*/
private HashMap myMap;
...
------------------------------------

If I create a unidirectional association from "myclass" to
"java.lang.String" with 0..* cardinality, code like the following is added:

------------------------------------
/**
*/
private java.util.Collection myStrings;
------------------------------------

I would prefer to see the two cases treated in the same way. In particular,
I would like to see the second case generate:

import java.util.Collection;
...
private Collection myStrings;


Handling the two situations in the same way would improve the consistency of
the generated code. The workaround (type "Map" directly into the
"Container" language property and specify the import statement manually)
works, but is a bit awkward.

Thanks.

-- Jim



Re: Treat the "Container" language property like any other class reference when generating code.

PostPosted: Fri Feb 22, 2002 5:04 am
by Egidijus Vaisnora
Hello Jim,

You are right, MagicDraw collects imports for elements which class relates
on, but it doesn't check the language property values. We will mark it as
suggestion in other suggestion list and consider.

Best Regards,
--
Egidijus Vaisnora
Programmer
No Magic
Gedimino g. 47- 408, 3000 Kaunas
P.O. box 2166, LT- 3000, Kaunas
Phone: +370 7 324032 Fax: +370 7 320670
e-mail: Egidijus.Vaisnora
WWW: http://www.nomagic.com
--
OO software design can be an appealing challenge if you have
the best UML modeling tool: http://www.magicdraw.com

>