Where to put java package-level information to use

2019-06-23 14:52发布

Some API docs contain information at package level. For example java.io contains 3 package-level sections here http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html

The sections are: "Package java.io Description", "Package Specification" and "Related Documentation".

Where should I put these sections content in my own project so that javadoc processes it in the same way?

3条回答
老娘就宠你
2楼-- · 2019-06-23 15:37

create a file called package-info.java in each package

inside do the following

/**
 * Javadoc
 */
package my.cool.package123;
查看更多
混吃等死
3楼-- · 2019-06-23 15:43

You have to put a file called package-info.java into the folder that contains your package.

查看更多
SAY GOODBYE
4楼-- · 2019-06-23 15:51

You put those comments in a package comment file (emphasis mine):

Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package.

To create a package comment file, you have a choice of two files to place your comments:

  • package-info.java - Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is generally preferred over package.html .
  • package.html - Can contain only package comments and Javadoc tags, no package annotations.
查看更多
登录 后发表回答