javadoc a very short tutorial. what is it a program that automatically generates documentation of...

6
Javadoc A very short tutorial

Upload: jesse-daniels

Post on 05-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java

Javadoc

A very short tutorial

Page 2: Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java

What is it

• A program that automatically generates documentation of your Java classes in a standard format

• For each X.java it will create an X.html, plus a couple of additional pages (index, ..)

• How: javadoc [options] {package | file(s)}– E.g.: javadoc *java

Page 3: Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java

What is extracted?

• A description of all public and protected classes, interfaces, methods, and data fields

+• Special comments that you supply:

/** * summary line * … * more info*/Must immediately precede relevant code section

Page 4: Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java

Tags

• Allow you to specify specific information:– For classes and interfaces:

@author Name

@version Version number

– For methods:@param name description

@return description

@exception exceptionClass description

@deprecated description

– For everything:@see reference

Page 5: Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java

HTML tags

• You can include HTML tags in your special comments (but should not use <h1> or <h2>).

• Commonly useful tags: <i>, <br>, <p>

Page 6: Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java

Options/Links

• Lots of options, e.g. -public (only public elements extracted)

-protected (public and protected = default)

-private (also include private elements)

• See also:– Online source example: java/sources/Javadoc– Sun docu:

http://java.sun.com/j2se/javadoc/index.html