如何为类似功能重用javadoc [英] How to reuse javadoc for similar functions

查看:60
本文介绍了如何为类似功能重用javadoc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我具有以下功能:

/**
 * Thorough explanation
 *
 */
public void somethingImportant(String parameter)
{
   (...)
}

为方便起见,我添加以下功能:

Now for convenience, I add the following function:

public void somethingImportant()
{
   somethingImportant(null);
}

这两个函数的javadoc应该相邻.也许唯一的区别是,第一个函数有一个额外的行来描述parameter的作用.

The javadoc for both functions should be next to identical. Perhaps the only difference is that the first function has an extra line describing what parameter does.

有什么方法可以避免简单地复制现有的javadoc,而是重新使用它?

Is there any way to avoid simply copying the existing javadoc, and instead reusing it?

推荐答案

使用@see标记并指向原始的未重载方法怎么样?然后,在重载方法中,您可以只使用@param值.

What about using @see tag and pointing to the original, non-overloaded method? Then in the overloaded method you can just use the @param value.

/**
*@see #yourMethod()
*/

这篇关于如何为类似功能重用javadoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆