Specifying Attribute Types in Papyrus

I recently installed Papyrus and tried to follow the tutorial on creating a model and throwing out Java code.

Unfortunately, I was almost stuck at the very beginning. In the class definition, I added a static operation for main , and I can specify its argument as an array:

 in args: <Undefined> [*] 

Unfortunately, this does not allow me to specify the type String. That is, I would like to indicate it as follows:

 in args: String [*] 

No matter how I enter the type (or any type, for that matter), the type returns to <Undefined> . I suspect that something is wrong or not with the profile that it should use. Unfortunately, the documentation for this tool is rather scarce, and I can not find an answer or solution for this.

Has anyone encountered this problem?

+6
source share
4 answers

Have you imported the UML Primitive package? This should allow you to specify the type of the argument for Integer, String, or Boolean.

In Model Explorer, right-click on your model, then select "Import Package from Registered Library"
In the window that appears, select "UMLPrimitiveTypes" (or Java, if you prefer).
After that, it should work.

+18
source

In the latest version of Papyrus, you need to go to the model explorer, right-click on your model and then select "Import". After that, select "Import registered package." This will bring up a dialog with a list of registered packages. From this you can choose "UMLPrimitiveTypes" or "JavaPrimitiveTypes"

+4
source

Papyrus believes that modeling is language independent, and therefore the java type is usually not possible. This is quite logical in the MDA approach, but not in real life :-)

There is an accelerator plugin that should generate code from the diagram, but it does not work with the latest version of Helios, so ..... It’s best to make a class diagram and then manually encode the corresponding code. I'm sure your code will be better than the one you can get from the accelerator :-)

+1
source

It is very simple, you can do this simply by clicking on the property attribute, then select the type option, select Tree in the menu bar, then Primitive types .

0
source

Source: https://habr.com/ru/post/896620/


All Articles