Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
documentation of getter / setter
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Julien Iguchi-Cartigny  
View profile  
 More options Nov 13 2009, 4:26 pm
From: Julien Iguchi-Cartigny <kart...@gmail.com>
Date: Fri, 13 Nov 2009 13:26:43 -0800 (PST)
Local: Fri, Nov 13 2009 4:26 pm
Subject: documentation of getter / setter
Hi,

I'm trying to document a setter / getter using new syntax to define
them with javascript 1.5, but It didn't work (the get / set functions
don't appear in the generated documentation). Is it a special way to
use jsdoc -toolkit to make them appear in the documentation ?

This my source code with documentation, neither get category() and set
category(c) appear:

/**
 * Creates a new Tag instance
 *
 * @class The Tag class
 * @constructor
 * @public
 * @param {String} name The name of the tag
 */
function Tag(name) {

    /**
     * The name of this tag
     *
     * @public
     * @type String
     */
    this.name = name;

    /**
     * The category where the tag belong
     *
     * @private
     * @type Category
     */
    this._category = null;

}

Tag.prototype = {

    /**
     * Getter for category. This function exists to forbid access to
     * #category if no save has been done.
     *
     * @public
     * @throws Error if the tag instance has not been saved
     */
    get category() {
        if(typeof(this.id) === "undefined") {
            throw new Error("save Tag before get category property");
        }
        return this._category;
    },

    /**
     * Setter for category property. This function exists to forbid
access to
     * #category if no save has been done.
     *
     * @public
     * @param {Category} c the category set for the tag
     * @throws Error if the tag instance has not been saved
     */
    set category(c) {
        if(typeof(this.id) === "undefined") {
            throw new Error("save Tag before set category property");
        }
        return this._category = c;
    }

};

Cheers,

Julien.


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Julien Iguchi-Cartigny  
View profile  
 More options Nov 15 2009, 10:44 am
From: Julien Iguchi-Cartigny <kart...@gmail.com>
Date: Sun, 15 Nov 2009 07:44:54 -0800 (PST)
Local: Sun, Nov 15 2009 10:44 am
Subject: Re: documentation of getter / setter
Hello again,

I've patch my jsdoc-toolkit install with the getter/setter patch found
here:

<http://code.google.com/p/jsdoc-toolkit/issues/detail?id=169>

But you have still some problems (with the same code posted in my
previous email):

- the setter is parsed as a variable, so the text of the field is the
setter description
- there is no mention of the getter

This is not convenient for me: I want to see the getter / setter
methods.

Any proposition to update this code ?

Cheers,

Julien.

On Nov 13, 10:26 pm, Julien Iguchi-Cartigny <kart...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Mathews  
View profile  
 More options Nov 15 2009, 11:20 am
From: Michael Mathews <micm...@gmail.com>
Date: Sun, 15 Nov 2009 16:20:14 +0000
Local: Sun, Nov 15 2009 11:20 am
Subject: Re: documentation of getter / setter
Hi Julien,

Sorry for my late response. I am trying to catch up but life seems to
keep speeding up!

I've had a think about your question and proposal, but I don't want to
add set and get support into the core of JsDoc Toolkit yet. There are
still options for you. Firstly, you can accomplish pretty much
anything by simply turning off the static code analysis feature of
JsDoc Toolkit, see the link below (you can skip right to the "but wait
there's more" section if you want).

http://code.google.com/p/jsdoc-toolkit/wiki/FAQ#How_to_get_JsDoc_Tool...

Another option, or an additional option if you wish to combine the two
techniques, is to use labelled symbols. This is how I was able to add
support for functions that were really events into JsDoc Toolkit.
Basically you add a `@name label:symbolName` to your docs and then in
your template you can present that name however you wish, removing the
'label:' perhaps, or whatever else you like. In your case you could do
this:

Tag.prototype = {

    /**
     * Getter for category. This function exists to forbid access to
     * #category if no save has been done
     * @name Tag#get:category
     * @function.
     * @throws Error if the tag instance has not been saved
     */
    get category() {
        if(typeof(this.id) === "undefined") {
            throw new Error("save Tag before get category property");
        }
        return this._category;
    },

    /**
     * Setter for category property. This function exists to forbid access to
     * #category if no save has been done.
     * @name Tag#set:category
     * @function
     * @param {Category} c the category set for the tag
     * @throws Error if the tag instance has not been saved
     */
    set category(c) {
        if(typeof(this.id) === "undefined") {
            throw new Error("save Tag before set category property");
        }
        return this._category = c;
    }

};

I'll leave it to you to modify the template to show that in a way you
like, but if you need help with that let me know.

Regards,
Michael

On 15/11/2009, Julien Iguchi-Cartigny <kart...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google