Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

java - 如何在javadoc中引用方法?(How to reference a method in javadoc?)

How can I use the @link tag to link to a method?

(如何使用@link标记链接到方法?)

I want to change

(我想改变)

/**
 * Returns the Baz object owned by the Bar object owned by Foo owned by this.
 * A convenience method, equivalent to getFoo().getBar().getBaz()
 * @return baz
 */
public Baz fooBarBaz()

to

(至)

/**
 * Returns the Baz object owned by the Bar object owned by Foo owned by this.
 * A convenience method, equivalent to {@link getFoo()}.{@link getBar()}.{@link getBaz()}
 * @return baz
 */
public Baz fooBarBaz()

but I don't know how to format the @link tag correctly.

(但我不知道如何正确格式化@link标签。)

  ask by Jason S translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You will find much information about JavaDoc at the Documentation Comment Specification for the Standard Doclet , including the information on the

(您可以在标准Doclet文档注释规范中找到有关JavaDoc的更多信息,包括有关的信息)

{@link package.class#member label}

({@link package.class#member label})

tag (that you are looking for).

(标签(您正在寻找)。)

The corresponding example from the documentation is as follows

(文档中的相应示例如下)

For example, here is a comment that refers to the getComponentAt(int, int) method:

(例如,这是一个引用getComponentAt(int,int)方法的注释:)

Use the {@link #getComponentAt(int, int) getComponentAt} method.

The package.class part can be ommited if the referred method is in the current class.

(如果引用的方法在当前类中,则可以省略package.class部分。)


Other useful links about JavaDoc are:

(关于JavaDoc的其他有用链接是:)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...