如何创建一个私有字段的javadoc链接?
class Foo {
private String bar;
public String getBar() { return bar; }
}
Run Code Online (Sandbox Code Playgroud)
{@link Foo#getBar()} 作品.
{@link Foo#bar} 没有.
mic*_*ael 115
语法很好,一个类中的以下工作(并且没有理由链接到来自不同类的私有字段):
public class Demo {
private int num = 0;
/**
* Access field {@link Demo#num} / {@link #num} ...
*/
private void foo() { ... }
...
Run Code Online (Sandbox Code Playgroud)
在生成javadoc时,例如,通过ant,只需指定应包含私有字段(默认的最小访问权限为"protected",而不是"private"):
<target name="javadoc" depends="compile" description="gen javadoc">
<javadoc destdir="build/docs"
author="true"
version="true"
use="true"
access="private"
windowtitle="Demo API">
<fileset dir="src/main" defaultexcludes="yes">
<include name="com/**"/>
</fileset>
<doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
<link offline="true" href="http://download.oracle.com/javase/6/docs/api/" packagelistLoc="doc"/>
</javadoc>
</target>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
61385 次 |
| 最近记录: |