Detailed explanation of Java code annotation specification
Code with comments is very important for program developers. With the development of technology, programmers must be required to write code comments in the process of project development, which is conducive to the subsequent writing and use of code.
Basic requirements:
1. Unified annotation form
Throughout the application, annotations are constructed using styles with consistent punctuation and structure. If you find that their annotation specifications are different from this document in other projects, write code according to this specification and do not try to introduce new specifications into the existing specification system.
2. The notes are accurate and concise
The content should be simple, clear and accurate, so as to prevent the ambiguity of notes. Wrong notes are not only useless but harmful.
3. Basic notes (must be added)
(a) Comments on classes (interfaces) (b) comments on constructors (c) comments on methods (d) comments on global variables (E) comments on fields / attributes remarks: simple comments are required for simple code, and the comment content is no more than 10 words. In addition, getter and setter methods of persistent objects or VO objects do not need comments. Please refer to the following examples for the specific annotation format.
4. Special notes (mandatory)
(a) Typical algorithms must be annotated. (b) There must be comments where the code is unclear. (c) Add comments on the modification identification at the code modification. (d) Annotate the code consisting of loops and logical branches. (e) Interfaces provided to others must be annotated in detail.
Note: there is no example of such note format. The specific annotation format is self-defined, and the annotation content is required to be accurate and concise.
5. Note format:
1) , single line comment: "/ /..." 2), block comment: "/ *... * /" 3), document comment: "/ * *... * /" 4), Javadoc comment label syntax
@The author's description of the class indicates the author who developed the module of the class @ version's description of the class indicates the version of the module of the class @ see's description of the class, attribute and method, That is, the related topic @ param describes the method, the parameter in the method, @ return describes the method, the return value of the method, @ exception describes the method, and describes the exceptions that may be thrown by the method
6. Example:
Enter the command as shown in the figure below:
Then view it in the following directory, and finally click index html:
The above content has shared the Java code annotation specification, and I hope it will be helpful to you.