0

我有一个接口IFoo(不是真名),我正在尝试为其编写 Javadoc——这是一个通过 JSR223 向 Rhino/Jython 脚本公开的包,而这个接口是唯一公开的一个。

它有许多相当简单的方法。其中许多是豆类,但有些不是。

public void setBar(double x);
public double getBar();
public void setBigQuux(int n);
public int getBigQuux();
public void setLittleQuux(int n);
public int getLittleQuux();
public void clearQuuxes();

我的问题是,许多这些方法形成了自然群体。一种方法,看起来像是 Sun 选择的一种(我看过一些 Swing 类),是为每个组选择一种方法,并将大部分相关信息放在其 javadoc 中,然后链接其他方法带@see标签。记录密切相关的方法组的另一种方法(对我来说似乎是一种更好的方法)是将一个部分放入类 Javadoc 标头中,然后将简要摘要放入方法标头中,但参考标头,但是我不知道该怎么做:

/**
 * Foo
 * <p>
 * Quuxes: these are magic knobs that control quux content. A foo has a big quux
 * and a little quux. (etc) (I want to link here from the quux-related methods)
 */
interface IFoo    
{
  /**
   * Sets the big quux
   * @param n new value
   * @see ???? how to refer to the quux section of the class header?
   */
  public void setBigQuux(int n);
  /**
   * Gets the big quux
   * @return big quux 
   * @see ???? how to refer to the quux section of the class header?
   */
  public int getBigQuux();
  /* etc */
}

任何人都可以帮助我,或解释为什么这是一个坏主意吗?

4

1 回答 1

1

啊哈,让它工作,在标题和行中使用<a name="abcd">/<a href="#abcd">标记对@see。此语法的参考位于@see.

/**
 * Foo
 * <p>
 * <a name="quuxes">Quuxes</a>:
 * these are magic knobs that control quux content. A foo has a big quux
 * and a little quux. (etc) (I want to link here from the quux-related methods)
 */
interface IFoo    
{
  /**
   * Sets the big quux
   * @param n new value
   * @see <a href="#quuxes">quuxes</a>
   * @see #getBigQuux
   */
  public void setBigQuux(int n);
  /**
   * Gets the big quux
   * @return big quux 
   * @see <a href="#quuxes">quuxes</a>
   * @see #setBigQuux
   */
  public int getBigQuux();
  /* etc */
}
于 2012-05-15T19:16:50.847 回答