DevEco Studio配置:自定义头部代码注释

举报
坚果的博客 发表于 2022/08/05 13:57:40 2022/08/05
【摘要】 DevEco Studio配置:自定义头部代码注释1.实现效果/* * Copyright (c) 2022 JianGuo Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance wi...

DevEco Studio配置:自定义头部代码注释

1.实现效果

/*
 * Copyright (c) 2022 JianGuo Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**     
  * @ProjectName : nutsStudy
  * @FileName :  setting
  * @Author : 坚果
  * @Time : 2022/8/5 13:51
  * @Description : 文件描述 
 */

2.实现步骤

依次操作File – Settings – Editor – File and Code Templates,在详细展示窗口点击includes选项卡,找到

FileHeader点击,在编辑窗口输入自定义的注释模板即可。如下图:

image-20220805134840454



3. 总结

${PACKAGE_NAME} 新建文件所在包名
${USER} 用户名
${DATE} 创建文件时当前系统的日期(格式:yyyy/MM/dd)
${TIME} 创建文件时当前系统的时间(格式:hh:mm)
${YEAR} 创建文件时当前系统的年份
${MONTH} 创建文件时当前系统的月份
${MONTH_NAME_SHORT} 当前月份的前三位字符缩写,例如: Jan, Feb, etc
${MONTH_NAME_FULL} 当前月份的字母全写,例如: January, February, etc
${DAY} 当前时间所属月份的天数
${HOUR} 当前的小时数
${MINUTE} 当前的分钟数
${PROJECT_NAME} 当前的项目名
${NAME} 当前的文件名


4.我添加的内容

/*
 * Copyright (c) 2022 JianGuo Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**     
  * @ProjectName : ${PROJECT_NAME}
   * @FileName : ${NAME}
  * @Author : 坚果
  * @Time : ${DATE} ${TIME}
  * @Description : 文件描述 
 */


效果:

image-20220805135335344

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。