javadoc

方法有三:

1.选择工程,在菜单Project->Genarate Javadoc

2.选择工程,鼠标右键菜单Export ,选择Java 下面的Javadoc ,点”next” 按钮

3.选择工程,在菜单File->Export ,选择Java 下面的Javadoc ,点”next” 按钮

javadoc乱码解决

这里面有两个指定编码问题的参数

1) -encoding charsetName

2) -charset charsetName

第一个参数表示javadoc 程序读取java源文件时候应该采用什么编码

第二个参数表示javadoc 程序写html文件时采用的编码形式,并会在HTML中加入如下标签

<META http-equiv="Content-Type" content="text/html; charset=utf-8">

在第三个对话框的"Extra Javadoc options" 文本框里面加上:                 

-encoding UTF-8 -charset UTF-8

Java中有三种注释方法:

1. //被注释语句 

2. /*被注释语句*/

3. /**被注释语句*/

其中第三种专为JavaDoc设计,可以被JDK内置的JavaDoc工具支持和处理。

javadoc 标记有如下一些: 
Tag           Introduced in JDK/SDK 
@author              1.0 
{@code}              1.5 
{@docRoot}              1.3 
@deprecated              1.0 
@exception              1.0 
{@inheritDoc}              1.4 
{@link}              1.2 
{@linkplain}              1.4 
{@literal}              1.5 
@param              1.0 
@return              1.0 
@see 1.0 
@serial              1.2 
@serialData              1.2 
@serialField              1.2 
@since              1.1 
@throws              1.2 
{@value}              1.4 
@version              1.0

Overview Tags  @see @since  @author @version {@link}  {@linkplain}  {@docRoot}

Package Tags  @see @since  @serial @author @version {@link}  {@linkplain}  {@docRoot

Class/Interface Tags  @see @since  @deprecated @serial @author @version {@link}  {@linkplain}  {@docRoot}   

Field Tags  @see @since  @deprecated @serial @serialField {@link}  {@linkplain}  {@docRoot}  {@value}   

Method/Constructor Tags  @see @since  @deprecated @param @return @throws and @exception @serialData {@link}  {@linkplain}  {@inheritDoc}  {@docRoot}    

 

Order of Tags Include tags in the following order:

•@author (classes and interfaces only, required)

•@version (classes and interfaces only, required. See footnote 1)

•@param (methods and constructors only)

•@return (methods only)

•@exception (@throws is a synonym added in Javadoc 1.2)

•@see 

@since

•@serial (or @serialField or @serialData)

•@deprecated (see How and When To Deprecate APIs)

Multiple @author tags should be listed in chronological order, with the creator of the class listed at the top.

Multiple @param tags should be listed in argument-declaration order. This makes it easier to visually match the list to the declaration.

Multiple @throws tags (also known as @exception) should be listed alphabetically by the exception names.  

Multiple @see tags should be ordered as follows, which is roughly the same order as theirarguments are searched for by javadoc, basically from nearest to farthest access, from least-qualified to fully-qualified, The following list shows this progression. Notice the methods and constructors are in "telescoping" order, which means the "no arg" form first, then the "1 arg" form, then the "2 arg" form, and so forth. Where a second sorting key is needed, they could be listed either alphabetically or grouped logically.

http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html#javadocdocuments

http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#javadoctags

我们在开发JAVA程序中, 可以使用Javadoc来进行程序文档的整理, 当程序编写完成, 利用Java自带的JavaDoc工具就可以生成规范的API说明手册. 下面是我自己整理的一些语法:
书写格式:
/** <- 这里一定要用两个星号, 否则会被认为是普通注释的
* ........
*/
public int getCount() { .......

Javadoc只能为public,protected两种权限的类成员进行处理注释文档。当然也可以使用-private参数强制进行处理, 我们可以在注释中嵌入HTML个标记来丰富最后文档的显示, 因为Javadoc最后生成的文档就是HTML.

/**
* 一些参数列表<p>
*
* @see 类名
* @see 完整类名 
* @see 完整类名#方法
*
* @param 参数名 说明 
* @return 说明
* @exception 完整类名 说明
* @deprecated

* @version 版本信息
* @author 作者名 
*/
说明:
@see : 就是文档中的 参见xx 的条目, 其实就是超链接.

一般来说, 文档有三种类型: 类注释, 变量注释, 方法注释, 这三中类型的注释除了都可以包含 @see 参数外, 其它所包含的参数是不同的.
1. 类注释
类注释是写在类前面的, 用来说明类的一些情况, 可以包涵 @version,@author参数, 但Javadoc缺省情况下不处理, 也就是说不在最后文档中出现的, 为了使用这些信息, 我们可以加入参数 -version和 -author来强制输出到最后的文档中.
2. 变量注释
变量注释写在变量前面, 只能包含 @see 参数
3. 方法注释
方法注释可以包括
@param : 参数名是指参数列表内的标识符, 说明就是一些解释性质的文字, 可以多行.
@return : 返回值的说明, 可以多行
@exception : 完整类名应该明确指定一个违例类的名字,它是在其它某个地方定义好的。而说明则阐述为什么这种特殊类型的违例会在方法调用中出现。说明可以多行
@deprecated : 指出一些旧功能已由改进过的新功能取代。该标记的作用是建议用户不必再使用一种特定的功能,因为未来改版时可能摒弃这一功能。若将一个方法标记为@deprecated,则使用该方法时会收到编译器的警告。

转载于:https://www.cnblogs.com/liyunzhi/articles/3493100.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值