JavaDoc 中@see 的用法? [英] Usage of @see in JavaDoc?
问题描述
在处理 JavaDocs 时我什么时候使用 @see
?它的用途是什么?
When do I use @see
when dealing with JavaDocs? What is its usage?
例如,如果 MethodA
调用 MethodB
那么我是否必须将 @see
放在 MethodB
的 javadoc 中并引用 MethodA
因为那是调用它的原因,还是我必须从 MethodA
引用 MethodB
因为它正在调用它.我在 Oracle 网站上阅读了有关 @see
的内容,在我看来它非常含糊,它说它的意思是另见",但并不是真正的意思!
For example if MethodA
calls MethodB
then do I have to put @see
in MethodB
's javadoc and reference MethodA
because that is what called it, or do I have to put a reference to MethodB
from MethodA
because it's calling it. I've read the stuff about @see
on the Oracle website and it seems to me to be incredibly vague, it says it means "see also" but not really what that means!
推荐答案
是的,很模糊.
您应该在任何时候使用它,对于您的方法文档的读者来说,查看其他方法可能也很有用.如果你的方法 A 的文档说像方法 B 一样工作,但是......",那么你肯定应该放一个链接.@see
的替代方法是内联 {@link ...}
标签:
You should use it whenever for readers of the documentation of your method it may be useful to also look at some other method. If the documentation of your methodA says "Works like methodB but ...", then you surely should put a link.
An alternative to @see
would be the inline {@link ...}
tag:
/**
* ...
* Works like {@link #methodB}, but ...
*/
当methodA调用methodB是一个实现细节并且与外部没有真正的关系时,这里不需要链接.
When the fact that methodA calls methodB is an implementation detail and there is no real relation from the outside, you don't need a link here.
这篇关于JavaDoc 中@see 的用法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!