Android creates a comment Template

Source: Internet
Author: User

Android creates a comment template by itself. As a programmer, it is important not only to have the ability to write code, but to develop a good writing habit. Today, we will give you a detailed description of how to create a comment template. You can also manually annotate the information for each class and method, but this is complicated. Why don't we create a comment template manually?
First, we need to compile a template xml file (codetemplates. xml)
2. Now we will write the content information of the main comments to the xml file, and I will directly paste the xml Information I used.

/**
* @ Description:
* @ Method Name: $ {enclosing_method}
* $ {Tags}
* @ Creator: $ {user}
* @ Creation time: $ {date }$ {time}
* @ Modifier: $ {user}
* @ Modification time: $ {date }$ {time}
* @ Modify remarks:
* @ Throws
*/ /**
* @ Description:
* @ Method Name: $ {enclosing_method}
* $ {Tags}
* @ Return type $ {return_type}
* @ Creator $ {user}
* @ Creation time $ {date }$ {time}
* @ Modifier $ {user}
* @ Modification time $ {date }$ {time}
* @ Modify remarks
* @ Since
* @ Throws
*/ /**
* & Lt; p & gt; Title: & lt;/p & gt;
* & Lt; p & gt; Description: & lt;/p & gt;
* $ {Tags}
*/ /**
* @ Param $ {param} $ {bare_field_name}
*/ /**
* $ {Tags}
* $ {See_to_target}
*/ /**
* @ Return $ {bare_field_name}
*/ /**
* @ Class description:
* @ Project name: $ {project_name}
* @ Package name: $ {package_name}
* @ Class Name: $ {type_name}
* @ Creator: $ {user}
* @ Creation time: $ {date }$ {time}
* @ Modifier: $ {user}
* @ Modification time: $ {date }$ {time}
* @ Modify remarks:
* @ Version v1.0
* @ See [nothing]
* @ Bug [nothing]
* @ Copyright go3c
* @ Mail * @ qq.com
*/ /**
* @ Title: $ {file_name}
* @ Package name: $ {package_name}
* @ Function Description: $ {todo}
* @ Author: $ {user}
* @ Creation time: $ {date }$ {time}
* @ Version v1.0
*/ /**
* @ Field: $ {field}
* @ Function description:
* @ Creator: $ {user}
* @ Creation time: $ {date }$ {time}
*/

3. How can we use this compiled xml file in eclipse? Now let me explain it to you! Window --> Preferences --> Java --> Code Style --> Code Templates --> Comments --> Import --> select codetemplates. xml --> OK to add the email address. The Creator name can be added to eclipse. ini in the eclipse directory-Duser. name = "whateveryouwant ".
4. How can we quickly use the annotation module information we have written in eclipse? When adding a comment, enter/** in the class name and press enter to automatically generate the following format comment:
/**
*
* @ Class description:
* @ Project name:
* @ Package name:
* @ Class Name: AppDao
* @ Creator:
* @ Creation Time: 10:32:30 AM
* @ Modifier:
* @ Modification time: 10:32:30 AM
* @ Modify remarks:
* @ Version v1.0
* @ See [nothing]
* @ Bug [nothing]
* @ Copyright
* @ Mail */

Enter/** in the method name and press enter to automatically generate the following format comment:
/**
*
* @ Description:
* @ Method Name: UpdatePlayerHistory
* @ Param db
* @ Param item
* @ Return
* @ Return type int
* @ Creator
* @ Creation Time: 10:22:36 AM
* @ Modifier
* @ Modification time: 10:22:36 AM
* @ Modify remarks
* @ Since
* @ Throws
*/
You must manually enter the description.


Note: This article is original. Please respect the individual's Labor achievements! Thank you!




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.