Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Eclipse Papyrus -generation code - getters/setters/return operation(Auto generate java getters and setters and Operation returns to found)
Eclipse Papyrus -generation code - getters/setters/return operation [message #1867656] Wed, 03 July 2024 07:40 Go to next message
Park Yu is currently offline Park YuFriend
Messages: 1
Registered: July 2024
Junior Member
Hello,
I'm new to Eclipse Papyrus so I'm seeking for your help!
I'm using Eclipse Papyrus 2023-06 and tried to create Diagram Class from Papyrus Project.

I created 2 properties : name and firstname and set these properties to visiblity "private", type "String". When generate java code from UML , it create private variables but no getters or setters. Is there a way to customize the code generation to show automaticaly the getters and setters???

Also , when I create an Operation and set return parameter , there is the type return but nothing like "return ..." inside the operation created.
It's send me :
public String showInformationUser(String infoUser) {
}
How can I generate the default return inside the operation??

Re: Eclipse Papyrus -generation code - getters/setters/return operation [message #1868040 is a reply to message #1867656] Tue, 09 July 2024 15:44 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 470
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi,
getters and setters are not generated in case of Java. It might be good to make this configurable, but this is currently not the case. One way to do this would be to define a model-to-model transformation that is executed prior to code generation. You might want to create an issue via [1].
The "return" inside the body is not generated automatically, as a developer has to replace it with the suitable content of the method body anyway. You can define this content on the model level using an opaque behavior that is linked to an operation. The examples shipped with Papyrus SW Designer do that.

[1] https://gitlab.eclipse.org/eclipse/papyrus/org.eclipse.papyrus-designer/-/issues



Previous Topic:Papyrus for Manufacturing (P4M)
Next Topic:Release candidate for Papyrus SW designer
Goto Forum:
  


Current Time: Mon Sep 09 06:39:01 GMT 2024

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

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

Back to the top