1

像 hadoop 这样的项目有很多参数,但所有这些文档都是从 xml 手动生成的,而不是来自代码

有没有办法使用可以生成此文档的注释来做某事?

  public static final String MAP_SORT_SPILL_PERCENT = "mapreduce.map.sort.spill.percent";

  <name>mapreduce.map.sort.spill.percent</name>
  <value>0.80</value>
  <description>The soft limit in the serialization buffer. Once reached, a
  thread will begin to spill the contents to disk in the background. Note that
  collection will not block if this threshold is exceeded while a spill is
  already in progress, so spills may be larger than this threshold when it is
  set to less than .5</description>
4

1 回答 1

0

您可以使用@param javadoc 标签在代码中生成参数信息,例如来自维基百科页面的这个示例

/**
 * Short one line description.                           
 *
 * @param  variable Description text text text.         
 * @return Description text text text.
 */    
public int methodName (...) {
    // method body with a return statement
}

这就是 Oracle 为 Java 生成官方文档的方式(示例)

于 2015-07-20T22:48:08.920 回答