Javadoc
From CS315
Javadoc is a software tool in Java created to produce HTML format API (Application programming interface) documentation. This tool is available by downloading the relevent JDK or SDK. The newest version is Javadoc 5, which is included in J2SE Platform Development Kit Standard Edition 5 (JDK 5).
Contents |
Examples
Here is the Javadoc page created for the java.util class ArrayList.
Here is an example of the code (Doc comment) used to define details of a method from Project 1: Date:
/**
* O(1) in space
* O(1) in time
* @param days the number of days to subtract (may be negative!)
* @return the date resulting from subtracting days
* @throws IllegalArgumentException if the resulting date precedes 1 Jan 1600
*/
public Date minus (long days) throws IllegalArgumentException {
@param, @return, and @throws are called block tags. Block tags are to be written in this order:
- @param : name, followed by parameter description
- @return : what the method returns
- @exception : original tag - is now @throws
- @author : author
- @version : SCCS string
- @see : adds "See Also" heading with a link or text
- @since : product version when the Java name was added to the API specification
- @serial : Criteria for Serialized Form
- @deprecated : when the API was deprecated and what to use as a replacement.
Creating a Javadoc in Eclipse
Eclipse will generate Javadoc, along with most IDEs. To generate a Javadoc in Eclipse, Click Project - Generate Javadoc. From there you can choose a folder or file to create a Javadoc for. It asks the user the Javadoc command, which is to specify which command to use to generate the javadoc. An example of this command:
- /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc
Download
Links
Written by Tessa Simpson
