Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Code generation
Code generation [message #1769906] Sat, 05 August 2017 01:28 Go to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012
Member
Hello,

I wanted to test a very simple model for code generation.
I created a profile with a stereotype that the stereotype has three attributes: a, b and c
Next, I created a model instance of that profile such that a class of instance model has an operation on a, b and c.
If I try to generate the code out of the model instance by right click-->Designer--> generate java code, the generated code is not correct. Can any one help me and explain how i can generate the code properly? I attach the simple profile and the model instance.

Thanks.
  • Attachment: testP.zip
    (Size: 5.75KB, Downloaded 81 times)
Re: Code generation [message #1770004 is a reply to message #1769906] Mon, 07 August 2017 13:06 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 138
Registered: March 2014
Senior Member
Please check out the HelloWorld page here:
https://wiki.eclipse.org/Papyrus/Codegen/CppHelloWorld
This should give you some pointers.

Steve
Re: Code generation [message #1770603 is a reply to message #1770004] Mon, 14 August 2017 21:47 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
I looked at your example and I'm not sure what you expect: the generated code does not compile, since the three variables a, b, and c (referenced from your opaque behavior) are not declared. You declare a stereotype with the attributes a, b and c in your specific profile, but the code generator does not know this profile and therefore ignores it.
If you want to add attributes to your class, declare them directly as UML properties (with an optional default value). Note that stereotype attributes are not UML properties, they extend properties of the meta-model.
Previous Topic:internalBlockDiagram.css reported as missing
Next Topic:Code generation
Goto Forum:
  


Current Time: Thu Apr 25 00:50:55 GMT 2024

Powered by FUDForum. Page generated in 0.03279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top