Eclipse自动生成注释,修改注释模板

来源:互联网 发布:程序员必须掌握的算法 编辑:程序博客网 时间:2024/05/22 04:59

以下学习过程中的笔记,部分内容来自网络和书籍。一方便以后查阅,二希望能帮助到别人,三希望高手指点。 


用Myeclipse开发项目是,自动生成注释十分方便快捷,但我们希望自动生成自己的名字和一些内容,同时团队开发过程中会出现每个人注释格式不一致等问题。 
下面介绍如果通过修改Myeclipse注解模板解决问题。 


本人Myeclipse常用的设置,可按需要作相应修改 
----------------------------------------------------- 
1. 类的版权注释格式及设置步骤方式: 
Eclipse -> Window -> Preferences -> Java -> Code Style -> Code Templates -> Code  -> New Java files  -> Edit 
Java代码  收藏代码
  1. /*   
  2.  * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.   
  3.  *   
  4.  * This software is the confidential and proprietary information of   
  5.  * Founder. You shall not disclose such Confidential Information   
  6.  * and shall use it only in accordance with the terms of the agreements   
  7.  * you entered into with Founder.   
  8.  *   
  9.  */     
  10. ${filecomment}    
  11. ${package_declaration}    
  12.     
  13. ${typecomment}    
  14. ${type_declaration}   


2.类的注释格式及设置步骤如下: 
Eclipse -> Window -> Preferences -> Java -> Code Style -> Code Templates -> Comments -> Types -> Edit 
Java代码  收藏代码
  1. /**   
  2.  * This class is used for ...   
  3.  * @author jseven1989  
  4.  * @version   
  5.  *       1.0, ${date} ${time}   
  6.  */     


3.类的方法注释格式设置方式: 
Eclipse -> Window -> Preferences -> Java -> Code Style -> Code Templates -> Comments -> Methods -> Edit 
Java代码  收藏代码
  1. /**  
  2.  * ${tags}  
  3.  * @author jseven1989  
  4.  */    
原创粉丝点击