Git Product home page Git Product logo

Comments (9)

MathieuAA avatar MathieuAA commented on July 23, 2024

Hi!

That's a pretty good idea! But that's the good part =).
Here comes the bad one: my main concern is that the JSON format can't have any comment, and we'd have to add yet another field in the JSON, and this field may (or may not) have a pretty big (in term of string length) value.
But then, the comments could be added directly to the templates, which is nice.

Let's have the input of the JHipster 6 @jdubois, @andidev, @deepu105, @gmarziou, @atomfrede, @gzsombor on this, but you have my "+1".

from jhipster-uml.

deepu105 avatar deepu105 commented on July 23, 2024

We can have the comment text as an optional parameter for the json and that
will be easier to handle so that in Jhipster templates you just need to
print it in a comment block
On 27 Aug 2015 00:47, "Mathieu ABOU-AICHI" [email protected] wrote:

Hi!

That's a pretty good idea! But that's the good part =).
Here comes the bad one: my main concern is that JSON can't have any
comment.

We rely too much on the JSON dumped (and consumed) by JHipster that it
would be pretty hard, if not impossible, to achieve this.
That being said, if JHipster could take another format as input, or
another form of input...
The comments could be added directly to the templates.

Let's have the input of the JHipster 6 @jdubois
https://github.com/jdubois, @andidev https://github.com/andidev,
@deepu105 https://github.com/deepu105, @gmarziou
https://github.com/gmarziou, @atomfrede https://github.com/atomfrede,
@gzsombor https://github.com/gzsombor on this.


Reply to this email directly or view it on GitHub
#46 (comment)
.

from jhipster-uml.

andidev avatar andidev commented on July 23, 2024

@deepu105 suggestion gives a minimal impact on the generator so I say this is doable if wanted.
I could implement this in jhipster if wanted though I would like to have an example of where the comments should be placed and how they should look. I guess as javadoc comments for class and field? Not sure how to handle linebreaks though. Any suggestions on that?

from jhipster-uml.

mkresse avatar mkresse commented on July 23, 2024

@andidev Regarding the question if this feature is wanted enough: I think it would be a very useful feature and I would definitely use it. However I have no idea, how the majority of the jhipster-uml users utilize the software and whether it would support their workflow.

Regarding the implementation: class comments appear directly within the packagedElement class, an example produced by Modelio 3.3 looks like:

    <packagedElement xmi:type="uml:Class" xmi:id="_lZ6hZkyUEeWd98JY82OrEw" name="MyCoolClass">
        <ownedComment xmi:type="uml:Comment" xmi:id="_lZ6hZ0yUEeWd98JY82OrEw">
            <body>&lt;p&gt;This class represents the Magna ligula pellentesque. Lacus ut sed. Himenaeos litora et posuere. Accumsan purus inceptos. Ultricies praesent metus. /* Fames odio quam. */&lt;/p&gt;&lt;p&gt;TODO:&lt;/p&gt;

                &lt;ul&gt;
                &lt;li&gt;first &amp;uuml;ber&lt;/li&gt;
                &lt;li&gt;second&lt;/li&gt;
                &lt;/ul&gt;
            </body>
        </ownedComment>
    </packagedElement>

The body element contains plain html, which could be used as class comment without much modification (xml entity decoding assumed):

/**
 * <p>This class represents the Magna ligula pellentesque. Lacus ut sed. Himenaeos litora et posuere. Accumsan purus inceptos. Ultricies praesent metus. &#47;* Fames odio quam. *&#47;</p><p>TODO:</p>
 *
 * <ul>
 * <li>first &uuml;ber</li>
 * <li>second</li>
 * </ul>
 */
@Entity
@Table(name = "MYCOOLCLASS")
public class MyCoolClass {

New lines should be prefixed with " * " for nicer code layout and "*/" or in general slashes should be escaped using corresponding entity (&#47;). Since line breaking is recommended (http://www.oracle.com/technetwork/articles/java/index-137868.html), due to html being insensitive to line feeds, a simple word wrap algorithm could be used:

/**
 * <p>This class represents the Magna ligula pellentesque. Lacus ut sed. Himenaeos
 * litora et posuere. Accumsan purus inceptos. Ultricies praesent metus. &#47;*
 * Fames odio quam. *&#47;</p><p>TODO:</p>
 *
 * <ul>
 * <li>first &uuml;ber</li>
 * <li>second</li>
 * </ul>
 */

Attribute comments appear within <ownedAttribute> elements and should probably be transferred as a comment of the field declaration. Generally I suppose the same rules would apply. Maybe, since Modelio puts even on liners within <p> elements, stripping of enclosing paragraph elements might be a good idea?

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 23, 2024

@mkresse yes, parsing the comments from modelio XMI files seems easy, but don't forget the others!
If JHipster adds the support for comments, then JHipster-UML will too. It's an option worth the work.

from jhipster-uml.

andidev avatar andidev commented on July 23, 2024

So jhipster support for javadoc comments is ready to be merged! see PR jhipster/generator-jhipster#1952 for an example of how the json should look like and what will be generated.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 23, 2024

Ok! It should be ready next week in JHipster-UML (I hope so anyway, if we have time).
Great work by the way!

from jhipster-uml.

mkresse avatar mkresse commented on July 23, 2024

Wow, this looks really great - can't wait to try it out. Thanks a lot for your work.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 23, 2024

Closing this thread as the comment support has been added to JHipster-UML, the documentation will soon be updated too.

from jhipster-uml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.