Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Java Comments and Annotation with Code Generation
Java Comments and Annotation with Code Generation [message #1749724] Sat, 10 December 2016 09:40 Go to next message
Eclipse UserFriend
Hi Guys,
I am fearly new to Papyrus but I have found myself wondering on how to create Comments and Annotations in Papyrus that are supported by the CodeGenerator.
To be exact what do I have to do that Java annotations and JAvaDocs are generated from comments in a plugin.

Thanks in advance.

Best Regards
Hannes
Re: Java Comments and Annotation with Code Generation [message #1749903 is a reply to message #1749724] Tue, 13 December 2016 16:03 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
Hi,

it's not clear which code generation do you mean. If you want to generate code from a model, a UML comment whose "annoted element" reference points to an operation of a class or the class itself is taken into account in the generated C++ code or Java code and produce JavaDoc compatible comments in the code.
However, since you talk about JavaDocs generated from comments in a plugin, you refer to a different kind of generator?
Re: Java Comments and Annotation with Code Generation [message #1749922 is a reply to message #1749724] Tue, 13 December 2016 20:40 Go to previous messageGo to next message
Karim Deif is currently offline Karim DeifFriend
Messages: 2
Registered: December 2016
Junior Member
Hi,

I would like to add Java annotations not javadocs. For example I would like the generated java code to have @Document annotation not in a javadoc. I hope thats possible.
Re: Java Comments and Annotation with Code Generation [message #1749967 is a reply to message #1749922] Wed, 14 December 2016 14:24 Go to previous messageGo to next message
Eclipse UserFriend
I was refering to the standard Java Code Generator.

I found the option to get JavaDocs comments automatically generated:


  1. Create a Comment
  2. In properties click the plus on Annotaded Element and choose the Item that should have this comment written in JavaDocs (also possible is to use the Link connector)



What I now also like to know:

Karim Deif wrote on Tue, 13 December 2016 20:40
Hi,

I would like to add Java annotations not javadocs. For example I would like the generated java code to have @Document annotation not in a javadoc. I hope thats possible.


Re: Java Comments and Annotation with Code Generation [message #1750084 is a reply to message #1749967] Thu, 15 December 2016 22:07 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
Currently, Java annotations are not supported. The "Import" stereotype can be used to add an arbitrary string to the header of a Java file which could be used to add an annotation to a class, but not to specific methods.
If you feel that this is a bug, please file a bug with "severity = enhancement",
If you want to have a look at the generator code yourself:
The (xtend) class JavaDocumentation in plugin oepd.languages.java.codegen generates the JavaDoc. It could for instance be modified to use the comment text without JavaDoc prefixes, if comment text starts with a special character such as "@".
Re: Java Comments and Annotation with Code Generation [message #1751003 is a reply to message #1750084] Tue, 03 January 2017 15:21 Go to previous message
Shuai Li is currently offline Shuai LiFriend
Messages: 21
Registered: March 2016
Location: Paris Saclay, France
Junior Member
I guess we would need some stereotype for UML comments to express a Java annotation in a UML model, and distinguish them from normal UML comments.
Previous Topic:menuContribution to papyrus model menu
Next Topic:Get content from model viewer
Goto Forum:
  


Current Time: Fri Apr 19 03:34:09 GMT 2024

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

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

Back to the top