Skip to main content



      Home
Home » Modeling » Papyrus » Design, java code generation and template parameters
Design, java code generation and template parameters [message #1786192] Thu, 26 April 2018 12:46 Go to next message
Eclipse UserFriend
Hello
a coworker tries to generate java code with classifier template

to test we have

- Class T
- Class T1 extends T
- Class List, classifier template parameter T
- method foo returns T
- Class MyList extends T with a binding T1 -> T

but at java code generation
- Class List<T> : OK but method foo returns packageName.T and not T
- Class MyList is not generated.

is it something managed

we use Eclipse v4.7 oxygen, Papyrus 3.3.0.2018, Designer 1.0.5

[Updated on: Thu, 26 April 2018 12:48] by Moderator

Re: Design, java code generation and template parameters [message #1786898 is a reply to message #1786192] Tue, 15 May 2018 03:26 Go to previous messageGo to next message
Eclipse UserFriend
somebody already tested it ? I've found in the code some elements dealing with it so I don't understand it is not working :(
Re: Design, java code generation and template parameters [message #1786921 is a reply to message #1786898] Tue, 15 May 2018 11:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi Tristan,

sorry for the late reply. I have some trouble to understand the example: Why does MyList extend T and why is T1 is bound to T? I would rather expect that MyList has a template binding relationship with List in which T (the formal parameter) is bound to some other type (T -> otherType), but no inheritance from T. It seems that you are binding T1 which is not a parametered element of the signature (if I understand the setup right). Can you eventually post your example model?

Ansgar
Re: Design, java code generation and template parameters [message #1787008 is a reply to message #1786921] Thu, 17 May 2018 05:16 Go to previous message
Eclipse UserFriend
I tried the code generation from my sample model (which might not correspond to yours). In this model, class List defines a template parameter (DataType) T in its signature, the operation foo returns this type. MyList has a template binding relationship with list in which T is bound to class MyListElem. Class ListUser declares an attribute list of type MyList.

The code generated for List and ListUser looks ok (see below). No code is generated for MyList itself, but I don't consider this as a bug: there is no Java means to declare such a binding, you just use the bound classes at different places, such as the attribute declaration in class ListUser.

public class List<T> {
/** ... */
public T foo() {
return null;
}
};

public class ListUser {
public List<MyListElem> list;
};
Previous Topic:create a new sysml project/diagram
Next Topic:How can I integrate papyrus plugin in my rcp application? I want to access papyrus editor in my rcp
Goto Forum:
  


Current Time: Wed Jul 23 15:46:00 EDT 2025

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

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

Back to the top