java – 可以IntelliJ生成没有“get”前缀的getter吗?

IntelliJ有一个很酷的功能生成 Java getter.例如,对于一个字段private final String foo,它将生成一个getter getFoo().

有没有办法配置IntelliJ以String foo()格式生成getter?我正在主要使用不可变对象,并喜欢这种语法.

解决方法

整洁的问题!只是为了澄清@Danny Dan自从IntelliJ 15发布以来的答案…

要设置:

> Alt插入
>选择Getter
>从RHS上的“…”中打开模板配置
>从LHS创建新模板 – 请参见下面的示例
确定并选择您的新模板

示例模板:流利的吸气剂

public ##
 #if($field.modifierStatic)
   static ##
 #end
 $field.type ##
 ${field.name}() {
   return $field.name;
 }

你为什么想做这个?

结帐Implementing Domain-Driven Design

The simple but effective approach to object design keeps the Value Object faithful to the Ubiquitous Language. The use of getValuePercentage() is a technical computer statement,but valuePercentage() is a fluent human-readable language expression.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...