Search code examples
netbeansblockjavadocguard

JAVADOC in guarded blocks with netbeans


i'm writing a java application with Netbeans and i would like to include private variables in my Javadoc.
The problem is that I don't know how to modify the guarded blocks (for example the "// Variables declaration - do not modify" block) in order to write the comment for generating the javadoc. This guarded blocks are generated by "netbeans graphical GUI building tool".
Could anybody tell me if there is any way to include my comments in the guarded blocks?
Thank you in advance!


Solution

  • You can open the guarded code in an editor, copy and paste into a different class and then do whatever you want... (or you could probably just copy and paste directly from/to editor like Netbeans or Eclipse).

    I just came up with this idea, though, that you can open the directory that the .java file is in, open it in a text editor and then delete all of Strings that the IDE interprets and parses. These strings include the code GEN-BEGIN:name (name is the name of the method or it can be a generalized term like variables - this essentially means it can be anything) and GEN-END:name. All you have to do is delete those comments in the text editor and they are no longer recognized as generated code by the IDE.

    So, for a quick recap: go to the directory with the .java files (i.e. MyProject\src\mypackage\MyClassWithGuardedBlocks or wherever the .java files are) and then right-click and open in a text editor like Notepad (I personally like Wordpad); delete all of the GEN-BEGIN:blaBlas and GEN-END:blaBlas; close and reopen the project in the IDE or text editor or whatever you are using to edit your code; now edit whatever you want freely.

    This is a little sneaky and not what the creators of this would have wanted, so use it judiciously, please.

    I hope this helps, or I hope you found useful info online somewhere else.