如何引用javadoc中的方法? [英] How to reference a method in javadoc?
问题描述
如何使用 @link
标签链接到方法?
How can I use the @link
tag to link to a method?
我想改变:
/**
* Returns the Baz object owned by the Bar object owned by Foo owned by this.
* A convenience method, equivalent to getFoo().getBar().getBaz()
* @return baz
*/
public Baz fooBarBaz()
到:
/**
* Returns the Baz object owned by the Bar object owned by Foo owned by this.
* A convenience method, equivalent to {@link getFoo()}.{@link getBar()}.{@link getBaz()}
* @return baz
*/
public Baz fooBarBaz()
但我不知道如何正确格式化 @link
标签.
but I don't know how to format the @link
tag correctly.
推荐答案
您可以在 标准 Doclet 的文档注释规范,包括有关
You will find much information about JavaDoc at the Documentation Comment Specification for the Standard Doclet, including the information on the
{@link package.class#member label}
标签(您正在寻找).文档中对应的例子如下
tag (that you are looking for). The corresponding example from the documentation is as follows
例如,这里是引用 getComponentAt(int, int) 方法的注释:
For example, here is a comment that refers to the getComponentAt(int, int) method:
使用 {@link #getComponentAt(int, int) getComponentAt} 方法.
如果引用的方法在当前类中,则可以省略 package.class
部分.
The package.class
part can be ommited if the referred method is in the current class.
关于 JavaDoc 的其他有用链接是:
Other useful links about JavaDoc are:
这篇关于如何引用javadoc中的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!