There are cases that I use some method in the base class with the general usage (such as database CRUD methods), which I then better sort in the controlled which extends that base class.

Sometimes, I need to write javadoc for the method in controller so that I don't have to jump back to the super methods to check what is the purpose of some parameters. In such cases, I open the javadoc of the super method, copy the description and paste it into my controller method.

Now, doing it for a small amount of messages is OK, but now I am trying to make comments for the complete project and such copy/paste takes time.

Is there a way I can automatically put the parameter description from the original method's javadoc?

For example,

/**
 * A description of the controller method. Blah blah
 *
 * @param param1  My description
 * @param param2  My description
 * @param param3  A description copied from super method
 */
public void controllerMethod(Object param1, Object param2, Object param3) {
    //method's body...
}

So instead of pasting the description for the param3, is there a way I bind the original description with this parameter's javadoc? This way, it would not only be faster, but I don't have to change the description if it's ever updated in the super method.

有帮助吗?

解决方案

You can inherit the javadoc in some cases:

/** 
 * {@inheritDoc}
 */

Eclipse and Co should still find the javadoc.

However: Clear names for the parameters could avoid the problem, I think.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top