Specifying attribute types in Papyrus

luis.espinal picture luis.espinal · Sep 5, 2011 · Viewed 12.3k times · Source

I recently installed Papyrus and attempted to follow the tutorial for creating a model and generating Java code off it.

Unfortunately, I'm pretty much stuck right at the beginning. In the class definition, I added a static operation for main, and I'm able to specify its argument as an array:

in args: <Undefined> [*]

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

in args: String [*]

No matter how I enter the type (or any type for that matter), the type reverts back to <Undefined>. I suspect something is wrong or missing with a profile it is supposed to use. Unfortunately, the documentation for this tool is rather sparse, and I cannot find an answer or solution to this.

Anyone has run into this same problem as well???

Answer

JackStoneS picture JackStoneS · Sep 7, 2011

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

In the model explorer, right click on your model, then choose 'Import package from registered library'
In the window that pops up pick 'UMLPrimitiveTypes' (or the Java ones, if you prefer that).
After this, it should work.