一、getter与setter模板设置
- alt + insert -> Getter and Setter -> …
- getter模板
/**
* Gets the value of $field.name.
*
* @return the value of $field.name
*/
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($field.boolean && $field.primitive)
is##
#else
get##
#end
${name}() {
return $field.name;
}
3.setter模板
/**
* Sets the $field.name.
*
* <p>You can use get$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))() to get the value of $field.name</p>
*
* @param $field.name $field.name
*/
#set($paramName = $helper.getParamName($field, $project))
#if($field.modifierStatic)
static ##
#end
void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
#if ($field.name == $paramName)
#if (!$field.modifierStatic)
this.##
#else
$classname.##
#end
#end
$field.name = $paramName;
}
二、项目初始配置
1、常用的基本设置
- 展示Toolbar
View => Appearance => 勾选Toolbar
- 鼠标滚轮修改字体大小
Editor => General => 勾选Change font size (Zoom) with Ctrl+Mouse Wheel
- 三个地方修改字体大小
- 菜单字体:
Appearance & Behavior => Appearance
- 编辑区字体:
Editor => Font
- 控制台字体:
Editor => Color Scheme => Console Font
- 编码改为UTF-8:在设置中搜索encode,每个地方都找一下有没有需要修改的。
- autoscroll:
project => 设置图标 => 勾选Open File with Single Click以及Always Select Opened File"
- auto import:
Settings => Editor => General => Auto Import => 勾选Optimize imports on the fly(for current projeact)
2、编辑区设置
- tabs排序:
Settings => Editor =&g