问题描述
我想 B类
来继承,它实现了一个接口的Javadoc,接口A
。我已经包含在我的Javadoc命令接口A
来源和 B类
正确继承的文档。
I would like class B
to inherit the Javadoc from an interface that it implements, interface A
. I have included the source for interface A
in my Javadoc command, and class B
correctly inherits the documentation.
现在我想知道如果我可以把它生成指向接口A
的文档在网络上,而不是重复它在我的网站的链接,即指定者:链接将链接到外部页
Now I'm wondering if I can make the links it generates point to interface A
's documentation on the web, rather than duplicating it on my site, i.e. the "Specified by:" links will link to an external page.
这可能吗?
推荐答案
这是可能的,肯定的。
对于能够包括继承文档,界面A的源必须在Javadoc的源路径容易找到,但不应该是传递给的javadoc
的文档包的列表创建。
对于连接,使用 -link
参数。我只是想这(与蚂蚁的javadoc任务):
It is possible, yes.For being able to include inherited documentation, the source of interface A has to be findable in the sourcepath of javadoc, but should not be in the list of packages passed to javadoc
for documentation creation.For linking, use the -link
parameter. I just tried this (with the ant javadoc task):
<javadoc destdir="docs">
<sourcepath>
<!-- source of your class B -->
<pathelement location="src" />
<!-- source of external interface A -->
<pathelement location="../example-src/src" />
</sourcepath>
<!-- your packages, to generate the docs for -->
<package name="com.personal.myproject.*" />
<!-- the location of the online documentation -->
<link href="http://example.com/javadoc/"/>
</javadoc>
要命令行的javadoc,我觉得这个翻译是这样的(UNIX语法,一行):
To command line javadoc, I think this translates like this (unix syntax, one line):
javadoc -sourcepath ../example-src/src:src
-d docs
-link http://example.com/javadoc/
-subpackages com.personal.myproject
(other options...)
其中,
-
B类
是包com.personal.myproject
, -
接口A
是包com。示例
, - 我自己的来源是在
的src
, - 为接口的源代码是
../例如-SRC / src目录
。
class B
is in packagecom.personal.myproject
,interface A
is in packagecom.example
,- my own sources are in
src
, - the sources for interface A are in
../example-src/src
.
在此创建了一个示例类的Javadoc将从 A.methodName()
的文件复制到 B.methodName()
,但链接到在线文档在 http://example.com/javadoc/com/example/A.html#methodName()
。
In a example class created for this, javadoc would copy the documentation from A.methodName()
to B.methodName()
, but link to the online documentation at http://example.com/javadoc/com/example/A.html#methodName()
.
有关问这个问题谢谢,我一直想做到这一点: - )
Thanks for asking this question, I always wanted to do this :-)
这篇关于继承的javadoc,而不会生成文档的继承源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!