如何使用 @link
标签链接到方法?
我想改变:
/**
* 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
标签。
最佳答案
您可以在 Documentation Comment Specification for the Standard Doclet 找到更多关于 JavaDoc 的信息。 ,包括上的信息
标签(您正在寻找的)。文档中对应的例子如下
For example, here is a comment that refers to the getComponentAt(int, int) method:
Use the {@link #getComponentAt(int, int) getComponentAt} method.
如果引用的方法在当前类中,则可以省略 module/package.class
部分。
关于 JavaDoc 的其他有用链接是:
关于java - 如何在 javadoc 中引用方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5915992/