Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to document my method in Java like Java docs?

I want that when i mouse over a method i would be able to see my documentation of what the method does like when i put the mouse over Java's method I know that /** */ is how its done but:

  1. How do you explain what the Params Stands for?

  2. How do you create a new line, or make a word bold or italic?

like image 377
Ofek Ron Avatar asked Aug 01 '12 16:08

Ofek Ron


People also ask

How do you create a method document in Java?

From the main menu, select Tools | Generate JavaDoc. In the dialog that opens, select a scope — a set of files or directories for which you want to generate the reference, and set the output directory where the generated documentation will be placed.

What is Javadoc method?

Javadoc is a documentation tool which defines a standard format for such comments, and which can generate HTML files to view the documentation from a web broswer. (As an example, see Oracle's Javadoc documentation for the Java libraries at http://download.oracle.com/javase/6/docs/api/.)

How do you reference a method in Javadoc?

Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.


1 Answers

In most major IDEs, such as IntelliJ's IDEA, Apache Netbeans or Eclipse; you can type

/**

and press enter and it will generate the Javadoc for your method, including parameters, return values, etc. You just need to put in the descriptions.

The same applies for class declarations (the Javadoc comment always relates to the following element)

For instance

/**
 * create_instance
 * @param array of attributes for instance containing web, db, arrival_rate, response_time for instance 
 * respectively.
 * @return Instance object
 */
like image 78
Peter Ilfrich Avatar answered Oct 14 '22 17:10

Peter Ilfrich