Personal notes on Java
For other technologies like HTML, CSS, .NET, PHP, etc. check my other blog

Taking Advantage of Netbeans Javadoc Support


The IDE provides built-in Javadoc support for Java EE development. The IDE bundles with the Java EE 6 API Specification, which you can open in an external browser by choosing Help > Javadoc References > Java EE 6.

The IDE also includes various other features that enable easy access to API documentation:
  • Javadoc window: Choose Window > Other > Javadoc. The Javadoc window opens in the bottom region of the IDE, and displays API documentation relevant to your cursor's location in the editor.
  • Javadoc Index Search: Choose Help > Javadoc Index Search (Shift-F1; fn-Shift-F1 on Mac). Type in the name of the class you are looking for, then select a class from the listed results. The complete class description from the API Specification displays in the bottom pane of the window.
  • Documentation popup in the editor: Javadoc documentation displays in a popup window when you press Ctrl-Space on a given element in the editor. You can click the External Browser ( External Browser button ) button to have the documentation open in your browser. If you want to use Ctrl-Space for code completion only, you can deactivate the documentation popup by opening the Options window (Tools > Options; NetBeans > Preferences on Mac), then selecting Editor > Code Completion. Deselect the 'Auto Popup Documentation Window' option.

Generate Javadoc with netbeans:

  • Type "/**" just before a method/class declaration and press ENTER to generate a javadoc skeleton on the code. Also check option A on the image below:
 
  • A: Analyse and generate javadoc skeletons for every/any method/class;
  • B: Auto-generate Javadoc html files;
  • C: Right-click your netbeans project to get to this window where you can configure javadoc creation parameters;

Create package Javadoc

Ref: Use javadoc liberally
For classes and methods you just need precede their declaration with the /** ... */ tags.
But packages are special since they are folders not files (you cannot type text inside a folder can you?).

So, to add your own javadoc to one of your packages you need to create a special file named:
  • package-info.java
inside your package folder.
 
This file name is not a valid class name and it's not supposed too, since its not a class definition its just a content file to add package Javadoc.
Inside this file you can write:
/**
 * Write the javadoc for the package!
 * You can use any Javadoc content like annotation {@link SomeClass} or:
 * @author amano
 * @see SomeOtherClass
 */
package yourpackagename; 



References

Sem comentários:

Enviar um comentário