joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc

Home Page:http://www.jsonschema2pojo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing @param and @return tags for getter and setter methods

RagGren opened this issue · comments

By issue 218 (Generate @Param and @Returns javadoc) (pull request 219) @param and @retrun tags have been added.

This feature is not working for getter and setter (any more).
Currently only @param tags will be created, only for constructors. JDocComment#addParam( String) will only be called in ConstructorRule.
JDocComment#addReturn() will never be called.

title and descrition will currently be used in the Javadoc for getter and setter, but not as @param and @retrun tags, e.g.:

    /**
     * Titel of the property
     * <p>
     * Description of the property
     * (Required)
     * 
     */
    public Type getProperty() {
        return property;
    }

    /**
     * Titel of the property
     * <p>
     * Description of the property
     * (Required)
     * 
     */
    public void setProperty(Type property) {
        this.property = property;
    }

It should be something like this:

    /**
     * Gets the Titel of the property.
     * <p>
     * Description of the property
     * (Required)
     *
     * @return the Titel of the property
     */
    public Type getProperty() {
        return property;
    }

    /**
     * Sets the Titel of the property.
     * <p>
     * Description of the property
     * (Required)
     * 
     * @param property
     *     Titel of the property
     */
    public void setProperty(Type property) {
        this.property = property;
    }

N.B.: IMHO it would be sufficient to use only the title (if exists, otherwise the description) for the tags, but the current solution used for @param tags at constructors (title + . + description) is fine too.

@param and @retrun tags, including the title (and/or maybe description), should be added to getter and setter.