Book a Demo

Author Topic: Tagged value notes in code templates  (Read 3614 times)

Thomas Mayr

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Tagged value notes in code templates
« on: December 08, 2008, 10:29:06 pm »
Hi,

I'm trying to generate JavaDoc @throws comments from the model. So I need access to the tagged value notes of an operation, where these comments should obviousely be entered. So I tried the following code:

/**
$notes = %opNotes%
%if $notes != ""%
$notes += "\n"
%endIf%
$notes += %list="Parameter__JavaDoc" @separator="\n"%
$exceptions = %opTag:"throws"=="" ? "": "\n@throws " value%
$notes += $exceptions
%WRAP_COMMENT($notes, "73", " ", "* ")%
 */

However this doesn't work for several reasons:

1. Only the first tagged value with name "throws" ist used here
2. The note of the tagged value is missing.

So my questions:

1. Is ist possible to use the tagged values together with a %list% macro?
2. How can I access the note of a tagged value.

Best regards Thomas

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Tagged value notes in code templates
« Reply #1 on: December 09, 2008, 10:44:31 am »
First, I assume you know that there is a JAVADOC_COMMENT macro that does this for you.

Second, the templates can't to any of those things directly.  If you want to do that you're going to need to call an add-in with EXEC_ADD_IN.

Thomas Mayr

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Tagged value notes in code templates
« Reply #2 on: December 09, 2008, 08:15:42 pm »
Hi Simon,

JAVADOC_COMMENT does some formatting, which doesn't fit to your coding guidelines. So I want to remove the spaces between the parameter and the documentation after @param tags and to remove some new lines (\n). However, this is a minor problem.

I want further create @returns and @see JavaDoc tags from tagged values.

Another problem for us is, that @throws tags are converted to @exception when the code is synchronized with the model, am so @exception tags are created when code is generated from the model afterwards.

So it would be nice, if a more flexible JavaDoc formatting is supported by EA

Best regards Thomas

Thomas Mayr

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Tagged value notes in code templates
« Reply #3 on: December 09, 2008, 08:41:13 pm »
One add on:

The problem is when comments like this are reverse engineered:

    /**
     * A method.
     * @param p1 First parameter.
     * @param p2 Second parameter
     * @returns true or false
     * @throws Exception An exception
     * @throws Throwable Any exception
     * @see java.lang.Exception
     */

... and afterwards code is generated the comment looks like this:

    /**
     * A method.
     * @returns true or false
     * @see java.lang.Exception
     *
     * @param p1    First parameter.
     * @param p2    Second parameter
     * @exception Throwable Any exception
     * @exception Exception An exception
     */

We don't want to get the @returns and @see tags above the @param tags!

Thomas

Karen

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Tagged value notes in code templates
« Reply #4 on: May 26, 2009, 05:35:36 pm »
We have the same question. The biggest issue is that the @return tag can only be generated as part of the Notes on the operation and not from a separate field or tagged value like @param & @exception.
A secondary issue is the generation of @exception instead of @throws but we can live with that.

I assume we could write our own version of JAVADOC_COMMENT, but I suspect this would not fix the issue when synchronizing code, which would put the @return tag back in the Notes.

Is there any change to this in EA 7.5, or any change planned for a later release?