2015-07-20 71 views
1

项目Hadoop等有一吨的parameters,但所有的文档被手动从XML产生,而不是从code到来。是否有Java注释来生成参数文档?

有没有做一些的可以发这个文件的注释的方法吗?

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> 

回答

0

您可以使用@参数Javadoc标记生成代码中的参数信息,如this example from the wikipedia page

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

这是甲骨文是如何生成的Java (example)

+0

官方文档这是一个参数一个函数,这是一个程序的外部参数。 – Alun

+0

同样的规则适用,对吗?您仍然可以使用@param注释将javadoc放在main()方法上。如果这不是你想要的,你能澄清更多的问题吗? –