Generate association operations

Hello,
using the VP UML standard edition (6.0 SP2), I try to generate source files from a class diagram with two classes and one association between those classes (classes named “head” and “position”). I have one association between them being called “container”. Both ends of the association have a Role (“theHead” and “thePosition”) assigned to them and the multiplicitiy is set to 1 and 1 on both ends of the association and the association end at position is also set to “navigable”.
When I generate source from this diagram, there are no methods generated for handling the association operations. As far as I understand the documentation, there should be the possibility to generate source for the setter and getter methods of this association Is there any trick or special precondition to achieve the generation of association operations ?
Regards
Bernd

Hi Bernd,

Please try this:

  1. Right-click on the role label and select Open Specification from the popup menu

  2. Check “Provide property getter method” and “Provide property setter method” from the specification page.

  3. Generate code.

Please let me know if it works.

Best regards,
Jick
role-spec.png

Hello Jick,

works like a charm :wink:
Thank you very much !

Regards
Bernd

You are welcome! :smiley: :smiley:

Hello Jick,

another question: Can I add additional source code into my class diagrams inside VP UML before generating the class sources from the diagram ? Or do I have to generate the stub class from VP UML and edit the functionality in my IDE afterwards ?

And what about reimporting source and generate source after changing diagrms ? Are my changes coded in the outer IDE lost ?

Regards
Bernd

Hello Bernd,

Instant Generator will replace your code completely. If you want to make the implementation preserved, you can use the Java Round-Trip feature. Select Tools > Java Round-Trip > Generate Code… from the main menu.

If you are using an IDE, how about trying our Smart Development Environment (SDE)? SDE is an integrated modeling platform, seamlessly integrated with the IDE. For details, please read:
http://www.visual-paradigm.com/product/sde/

Best regards,
Jick

Hello Jick,

using Python as the language of choice, I have to stick with a different IDE. But it would be a very nice option, to see and edit the source inside VP UML.

By the way: What happens to diagrams when importing a source ? Are they getting updated or do I have to adjust them manually (e.g. if names of methods are changed) ?

Regards
Bernd

Hi Bernd,

After Instant Reverse, your current model will be replaced by the reversed model.

Best regards,
Jick