如何在javadoc中添加对方法参数的引用?
问题描述:
有没有办法从方法文档主体添加对一个或多个方法参数的引用?
类似于:
Is there a way to add references to one or more of a method's parameters from the method documentation body? Something like:
/**
* When {@paramref a} is null, we rely on b for the discombobulation.
*
* @param a this is one of the parameters
* @param b another param
*/
void foo(String a, int b)
{...}
答
就我而言在阅读 javadoc的文档之后可以知道没有这样的功能。
As far as I can tell after reading the docs for javadoc there is no such feature.
不要按照其他建议使用< code> foo< / code>
答案;你可以使用 {@ code foo}
。当您引用泛型类型(例如 {@ code Iterator< String>}
)时,这一点尤为明示 - 确定看起来比<代码> Iterator& lt; String& gt;< / code>
,不是吗!
Don't use <code>foo</code>
as recommended in other answers; you can use {@code foo}
. This is especially good to know when you refer to a generic type such as {@code Iterator<String>}
-- sure looks nicer than <code>Iterator<String></code>
, doesn't it!