Main Menu
Login
SSL SecureMode
Username:
Password:  
Lost Password?
Register now!
ChangeVision Members Map
Search
Forum Index   -   Topic Index
   How to use of Astah (Pro/SysML/GSN/Com)
     Specifying parameterized list types for Operation parameters and return types

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
shant712
Posted on: 2013/10/6 5:34
Just popping in
Joined: 2013/10/6
From:
Posts: 1
Specifying parameterized list types for Operation parameters and return types
Hi,
I am having trouble defining parameterized list types for Operation parameters and return types

My use case would be to model something like the following Java signature in Astah:
List<MyClassA> myMethod(int param1, List<MyClassB> param2)

I'd like to model this in Astah so I can directly refer to some other class in my model, i.e. MyClassA or MyClassB

But the only thing I can seem to do is to define the return type as java.util.List, and I am unable to refer to the paraterized type as MyClassA. While I can type in the "Type Modifier" value as MyClassA, it won't directly correspond to the class I've defined in the model (and so if the class name changes, it won't be reflected here)

Alternatively, I've tried to reverse-engineer a Java method with this signature into Astah, but it tries to create a new list class called "List<MyClassA>" (with that whole name), and that does not seem to be right either

Do you have suggestions on how I can handle this? I am using Astah 6.7.0

Thanks,
Shant
Joba
Posted on: 2013/10/10 7:56
Developer
Joined: 2006/6/6
From:
Posts: 969
Re: Specifying parameterized list types for Operation parameters and return types
Hi Shant,

Thanks for your post.
In Astah, parameterized list types can be represented by using Template Binding. In Astah 6.7, directly entering "List<MyClassA>" in Type can create a Class that is using Template Binding.

So for your case, please try this:

(1) Create a Class Diagram and a Class and add an operation to the Class.

(2) Directly enter "myMethod(param1 : int, param2 : List<MyClassB>): List<MyClassA>" to its operation.









(3) The Class appears as below when you hit enter







And when you see the structure tree, you can see that "List<MyClassA>" and "List<MyCassB>" are created which are used Template Binding.


















To see the Template Bindings of these Classes, bring them onto diagram from the structure tree, and select [Show Hidden Relationships] from its pop-up menu. You can see Template bindings like below.









Also regarding the name change, when you rename "MyClassA", that will be reflected to the "List<MyClassA>"











Hope this helps. If this doesn't meet what you were asking, please let us know.

Cheers,
SJ
Threaded | Newest First Previous Topic | Next Topic | Top