Skip to main content



      Home
Home » Modeling » Papyrus » Arrays and Constructors in Class Diagram(Questions on creating a Class Diagram)
icon5.gif  Arrays and Constructors in Class Diagram [message #1692040] Sun, 12 April 2015 11:55 Go to next message
Eclipse UserFriend
Am currently using Papyrus 1.0.2 with Eclipse Luna. Am currently attempting to create some Class Diagrams, using the Java Profile and Java primitive types.

Would like to ask the following, since I have been unable to figure out how to do it:

- How can I define a Constructor in a Class? Every operation I try to create will have a "void" return type if nothing is set.

- How can I create a array in the Class. I know I can set the multiplicity of an attribute, but when generating code, the attribute comes out like this: "List<DataType> var". I would like it to be a real array, like this: "DataType[] var".

Anybody have any idea how to do it, if it's possible?
Re: Arrays and Constructors in Class Diagram [message #1692113 is a reply to message #1692040] Mon, 13 April 2015 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

The Java Profile has stereotypes that convey Java-specific semantics:

* <<javaMethod>> has an 'isConstructor' attribute
* <<primitiveType>> has an 'implementationClass' attribute

For array types, you might just need to model them explicitly as
DataTypes of some kind. Perhaps the <<primitiveType>>
'implementationClass' attribute could let you specify the array
declaration, e.g., 'MyDataType[]' or even something like
'MyDataType[16][16]'.

Hopefully someone responsible for the Java component can chime in with
a better answer about array types ...

HTH,

Christian


On 2015-04-13 12:49:28 +0000, Karel Mous said:

> Am currently using Papyrus 1.0.2 with Eclipse Luna. Am currently
> attempting to create some Class Diagrams, using the Java Profile and
> Java primitive types.
> Would like to ask the following, since I have been unable to figure out
> how to do it:
>
> - How can I define a Constructor in a Class? Every operation I try to
> create will have a "void" return type if nothing is set.
>
> - How can I create a array in the Class. I know I can set the
> multiplicity of an attribute, but when generating code, the attribute
> comes out like this: "List<DataType> var". I would like it to be a real
> array, like this: "DataType[] var".
>
> Anybody have any idea how to do it, if it's possible?
Re: Arrays and Constructors in Class Diagram [message #1692311 is a reply to message #1692113] Wed, 15 April 2015 01:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

Thanks for your reply.

I've imported the Java Profile into the project via the Model Explorer and indeed notice that it contains a JavaMethod StereoType.

How can I use this stereotype to make my "operation" a Java Method?
Sorry I'm kinda new at the modeling tool, tried looking around the various menus but can't seem to find the correct solution to this problem.
Moreover when attempting to add a Profile or Stereotype to any part of my model, the contents of the Jave Profile do not appear as options.

Hope you can help.

Thanks in advance.

Karel

Edit:
Already found the solution, thanks to Christians answer in a different topic.
For the benefit of others, here is a short description on how to do it:

- Click on the model in the Model Explorer and view the properties of the model in the properties view.
- Click on the "Profile" option.
- In the "Profile Application" field, click on the third button "Apply Registered Profile".
- In the window that appears, select "Java" and click "OK".

After these instructions appropriate stereotypes can be connected to any element in the UML diagram via the "Profile" option in the element properties.

By unfolding the applied stereotype properties like "isConstructor" can be set.

[Updated on: Wed, 15 April 2015 01:47] by Moderator

Re: Arrays and Constructors in Class Diagram [message #1692389 is a reply to message #1692311] Wed, 15 April 2015 08:37 Go to previous message
Eclipse UserFriend
Hi, Karel,

Select your operation in the Model Explorer or a diagram. In the
Properties view, switch to the 'Profile' tab. There you have controls
for applying stereotypes to the operation and setting properties of
those stereotypes.

HTH,

Christian

On 2015-04-15 05:00:45 +0000, Karel Mous said:

> Hi Christian,
>
> Thanks for your reply.
>
> I've imported the Java Profile into the project via the Model Explorer
> and indeed notice that it contains a JavaMethod StereoType.
>
> How can I use this stereotype to make my "operation" a Java Method?
> Sorry I'm kinda new at the modeling tool, tried looking around the
> various menus but can't seem to find the correct solution to this
> problem.
>
> Hope you can help.
>
> Thanks in advance.
>
> Karel
Previous Topic:how to create a BDD to a sysml project
Next Topic:Collaborative work with svn - lock before modifications
Goto Forum:
  


Current Time: Sat Jul 05 01:57:01 EDT 2025

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

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

Back to the top