the basics of javadoc presented by: wes toland. outline overview background environment features...

15
The Basics of Javadoc Presented By: Wes Toland

Upload: alexandra-stevens

Post on 31-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

The Basics of Javadoc

Presented By: Wes Toland

Page 2: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Outline Overview Background Environment Features

Javadoc Comment Format Javadoc Program HTML API Documentation

Main Uses DEMO Comparison with Doxygen

Page 3: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Overview Generate Java API documentation in HTML

format (by default). Extract important information from:

Classes & Inner classes Interfaces Constructors Methods Fields

API documentation can be generated for: Entire packages Individual source files

Page 4: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Background Javadoc is included in Sun

Microsystem’s Java 2 Software Development Kit.

Javadoc 5 is included in the J2SE Platform Development Kit Standard Edition 5 (JDK5).

Javadoc has been supported since JDK1.1.

Page 5: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Environment Due to the Java Virtual Machine (JVM), the

Java Development Kit (JDK) and Runtime Environment (JRE) are supported on all platforms.

java.sun.com provides the JDK5 download, platform-specific installation instructions, and user manuals for each component of the development kit: javac (compiler) jar (archiver/packager) javadoc (API documentation tool) jdb (debugger)

Page 6: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: Comment Format Java developers follow a certain format

when creating Javadoc comments.

/** * JavadocDemo * </p>An applet with Javadoc comments * @author Wes Toland * @version $Id: Examples, v 1.0 2007/02/24 01:02:53 Exp $ * @see java.applet.Applet * @see java.swing.JApplet */ public class JavadocDemo extends Applet {

}

Page 7: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: Comment Format Javadoc comments begin with a \**

and end with */ Javadoc tags begin with @ Javadoc comments should be placed

above the class/method/interface being documented

Additional HTML formatting can be specified

Page 8: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: Javadoc Program Once a package or set of Java files have been

commented, run the Javadoc utility either from the command line or from IDE.

javadoc –d /home/toland/www –sourcepath /home/toland/src \ -subpackages java –exclude java.net;java.lang

cd /home/toland/srcjavadoc –d /home/toland/www java.awt java.awt.event

javadoc –d /home/toland/www –sourcepath /home/toland/src1;\ /home/toland/src2 java.awt java.awt.event

Example 1:

Example 2:

Example 3:

Page 9: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: HTML API Format Javadoc program generates nicely-formatted HTML API

documentation. HTML documentation is organized across the following

types of files: Basic content files Cross-reference pages Support files HTML frames

Basic content files contain the most important information for each: Class Interface Package

Page 10: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: HTML API Format

Class Hierarchy:

Page 11: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: HTML API Format

Class Documentation:

Page 12: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Features: HTML API Format

Quick-Reference API:

Page 13: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Main Uses Development

Quick Reference APIs are useful for internal development

Developers can quickly see what methods are available for use

See: http://java.sun.com/j2se/1.5.0/docs/api/ Commercial Releases

Detailed APIs are provided in addition to Quick Reference APIs

This is useful for clients to see if the developers met the specs

Page 14: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Comparison Supported programming languages:

Javadoc: Java only Doxygen: C/C++, Java, Python, PHP

Javadoc comments must be directly before the object being copied, Doxygen is configurable.

Link generation Java requires explicit object link path Doxygen requires an object name and will determine

link path Source code display

Java cannot display source code anywhere in the API documentation

Doxygen can display AND format source code in documentation

Page 15: The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API

Comparison Both support detailed and summarized API views

However, Doxygen can generate 2 separate documents where Javadoc includes both views in the same documentation.