如何在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.
不要像其他答案中推荐的那样使用 foo
;你可以使用 {@code foo}
.当您引用诸如 {@code Iterator<String>}
之类的泛型类型时,了解这一点尤其有用——当然看起来比 Iterator<String> 更好;</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!