继承 javadoc,不为继承的源生成文档 [英] Inherit javadoc, without generating docs for inherited source

查看:31
本文介绍了继承 javadoc,不为继承的源生成文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 class B 从它实现的接口 interface A 继承 Javadoc.我在我的 Javadoc 命令中包含了 interface A 的源代码,并且 class 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.

现在我想知道是否可以让它生成的链接指向网络上 interface 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 参数.我刚试过这个(用 ant 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...)

哪里

  • class B 在包 com.personal.myproject 中,
  • interface A 在包 com.example 中,
  • 我自己的源码在src
  • 接口 A 的源代码在 ../example-src/src 中.
  • class B is in package com.personal.myproject,
  • interface A is in package com.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,不为继承的源生成文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆