是否可以更改 IntelliJ 的 equals() 和 hashCode() 代码生成模板 [英] Is it possible to change IntelliJ's code generation template for equals() and hashCode()

查看:48
本文介绍了是否可以更改 IntelliJ 的 equals() 和 hashCode() 代码生成模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改 equals()hashCode() 的代码生成模板?

我希望生成的代码对这些方法使用 Java 7 Objects 类.

解决方案

截至 release 14.1,可以在不使用任何第三方插件的情况下自定义equals()/hashCode()的代码生成模板.>

按Alt + Insert"(生成...),选择equals() 和 hashCode()",您将能够选择预定义模板之一或您自己的自定义模板.

Is it possible to change the code generation template for equals() and hashCode()?

I would like the generated code to use the Java 7 Objects class for theses methods.

解决方案

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.

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.

这篇关于是否可以更改 IntelliJ 的 equals() 和 hashCode() 代码生成模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆