是否可以为equals()和hashCode()更改IntelliJ的代码生成模板 [英] Is it possible to change IntelliJ's code generation template for equals() and hashCode()
问题描述
是否可以更改 equals()
和 hashCode()
的代码生成模板?
Is it possible to change the code generation template for equals()
and hashCode()
?
我希望生成的代码使用Java 7 Objects
类来获取这些方法。
I would like the generated code to use the Java 7 Objects
class for theses methods.
推荐答案
从发布14.1 可以自定义equals()/ hashCode()的代码生成模板,而无需使用任何第三方插件。
As of release 14.1 of the Ultimate Edition it is possible to customize the Code generation template of equals()/hashCode() without the use of any third party plugin.
按Alt + Insert(生成...),选择equals()和hashCode(),您将能够选择其中一个预定义的模板或您自己的自定义模板。
Press "Alt + Insert" (Generate...), choose "equals() and hashCode()" and you will be able to select one of the predefined templates or a customized template of your own.
这篇关于是否可以为equals()和hashCode()更改IntelliJ的代码生成模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!