Suppose there are two class A and B.
Step 1: When I add an association between them, Together will generate code
like this,
public class A
{
private B linkB;
}
Step 2: Add multiplitity on this association close to the class B, for
example [1..*], Together will add a little comments.
public class A
{
/**
@supplierCardinality 1..*
*/
private B linkB;
}
Question1: Is this all what Together does? Because one comment means
nothing, should I add code manually?
Step 3: If I change the code to,
public class A
{
private Vector vecB;
}
The association disapperas from the diagram. I cannot add this association,
because code like below is unacceptable.
public class A
{
private Vector vecB;
/**
@supplierCardinality 1..*
*/
private B linkB;
}
Question 2: Do I misunderstand sth. of UML or Together?
Thanks,
John
"John Li" <john...@163.com> wrote in message
news:422e...@newsgroups.borland.com...
> Question1: Is this all what Together does? Because one comment means
> nothing, should I add code manually?
there is no 100% mapping between UML multiplicities and java code. In Tg
(all versions, starting from TCC),
link properties like cardinality, aggregation/composition don't affect
anything except for link appearance. We have an age-old feature request
regarding this - SCR#12709.
If you need to change your attribute to, e.g., collection, use the
corresponding link pattern (available via 'choose pattern' link menu item,
or via Link By Pattern toolbar button)
> Question 2: Do I misunderstand sth. of UML or Together?
and how can Tg quess that this is a link to class B? By attribute name? :)
What in this attribute declaration allows to figure out the link
destination? Normally (when collection is created by pattern), Tg uses
special comment (@associates tag ) to visualize such links. If you have some
code (except for attribute declaration) that realizes such collection, you
can run DCBA Audit - it will parse your code and insert @associates tags
automatically.
>
>
> Thanks,
> John
>
>