Javadoc 链接到另一个包中的类
我有两个包,Shapes
和 Fruits
:
com.myproject.Shapes.
Circle
Square
Triangle
com.myproject.Fruits.
Apple
Orange
我正在为 Apple
编写 JavaDoc,需要提供 {@link}< /code> 到
正方形
。
我已经尝试了以下所有方法,但都不起作用:
{@link Square}
{@link com.myproject.Square}
我已经能够找到链接到的文档:(a) 同一包中的类,或 (b) 外部 URL,但不能找到另一个包中的类。
有什么想法正确的语法应该是什么吗?谢谢!
I have two packages, Shapes
and Fruits
:
com.myproject.Shapes.
Circle
Square
Triangle
com.myproject.Fruits.
Apple
Orange
I am writing the JavaDoc for Apple
and need to provide an {@link}
to Square
.
I have tried all of the following, and none of them work:
{@link Square}
{@link com.myproject.Square}
I've been able to find documentation for linking to: (a) classes within the same package, or (b) externals URLs, but not classes in another package.
Any ideas what the correct syntax should be? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正确的语法变体是
您错过了完整的包装。下面的例子应该是正确的
The correct syntax variants are
You were missing a complete package. The following example should be correct
对于另一个包,请使用以下语法:
在您的情况下,这应该是:
如果您只想显示类名,则使用标签,如果需要完整路径,则不需要标签。
参考:
http://docs.oracle.com/javase /7/docs/technotes/tools/windows/javadoc.html#link
For another package use this syntax:
In your case this should be:
If you want to show only the class name then use the label, if complete path is desired then label is not required.
Reference:
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#link
这个问题很老了,但为有类似问题的人添加另一个答案。
使用
@see
将为您提供一个可单击的链接,以转到指定的类或方法,前提是该类(如果存在于另一个包中)已导入。如果引用的类/方法位于另一个模块中,则必须在当前模块中添加该模块的依赖项,以便 @see 可以为您提供可单击的链接。
The question is pretty old, but adding another answer for anyone having similar issue.
Using
@see
would give you a clickable link to go to a specified class or method, given that the class, if present in another package, is imported.In case the class / method being referred is in another module, you will have to add a dependency of that module in the current module so that @see can provide you with a clickable link.