Skip to main content



      Home
Home » Modeling » Papyrus » auto generate java getters and setters
auto generate java getters and setters [message #1774265] Thu, 12 October 2017 07:25 Go to next message
Eclipse UserFriend
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 10:18 Go to previous messageGo to next message
Eclipse UserFriend
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 04:53 Go to previous messageGo to next message
Eclipse UserFriend
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 13:46 Go to previous messageGo to next message
Eclipse UserFriend
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 05:29 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 21:12:40 EDT 2025

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

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

Back to the top