Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » auto generate java getters and setters
auto generate java getters and setters [message #1774265] Thu, 12 October 2017 11:25 Go to next message
Fabien Toune is currently offline Fabien TouneFriend
Messages: 1
Registered: October 2017
Junior Member
I'm using eclipse Oxygen.1a Release, with latest papyrus installed.
Is it possible to have setters, getters and/or default constructor generated automatically when applying "Generate Java Code" to a class diagram ?

To be more general, is there a way to customize the code generation ?

Thanx !

Fabien
Re: auto generate java getters and setters [message #1774384 is a reply to message #1774265] Fri, 13 October 2017 14:18 Go to previous messageGo to next message
Cedric Dumoulin is currently offline Cedric DumoulinFriend
Messages: 51
Registered: July 2009
Member
Have you checked in the Papyrus properties under Java code generator propoerties ?

In the original version of the Java code generator (which I developped), it was possible to set such options in Papyrus properties.
I don't know if such options still exist.

Cedric
Re: auto generate java getters and setters [message #1774481 is a reply to message #1774384] Mon, 16 October 2017 08:53 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Dear Fabien,

the code generation can be customized by executing a set of model-to-model transformations (on an intermediate model) prior to code generation, as shown here overview. We use this mechanism to implement state-machines. You can define an additional transformation on the model level and associate Java code that does the actual transformation. We will soon add a suitable documentation how to do that. In the meantime, you could check out the plugin org.eclipse.papyrus.designer.transformation.library (get the sources via git SW Designer git). A transformation is currently only executed, if you pass by a deployment plan, in which you can choose a transformation chain and additional transformations. If you want to play first with the mechanism, install the "Transformation" feature of SW Designer.

Ansgar
Re: auto generate java getters and setters [message #1842498 is a reply to message #1774481] Mon, 21 June 2021 17:46 Go to previous messageGo to next message
MICHAEL RIST is currently offline MICHAEL RISTFriend
Messages: 7
Registered: June 2021
Junior Member
Hello, Has any documentation been created surrounding this (since this post)? I am looking to use designer SW for code generation, however it doesn't seem to generate getters and setters automatically.

There is a different Java profile also available for code gen outside of Designer SW. It does automatically generate getters and setters, however if I create a method in papyrus (ie: opaque behavior with code), it is not carried over into the generated code (which using this profile).
Re: auto generate java getters and setters [message #1842888 is a reply to message #1842498] Mon, 05 July 2021 09:29 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hello,
from CEA side, there are no extensions that provide setters and getters for Java code generation.

Some information about the transformations in SW designer is here, please tell me, if it is sufficient or important information is missing.
Previous Topic:how to set guard specification
Next Topic:How can I prevent papyrus from generating the extra src-gen folder?
Goto Forum:
  


Current Time: Tue Apr 16 14:18:50 GMT 2024

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

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

Back to the top