自定义IntelliJ IDEA中的代码生成 [英] Customizing of code generation in IntelliJ IDEA
问题描述
我正在使用IntelliJ IDEA 12.我可以自定义使用Refactor功能生成的代码吗?
Im using IntelliJ IDEA 12. Can I customise code that is generated using "Refactor" functional?
例如我想更改设置生成的模板(Encapsulate来自:
For example I want to change the template of setting generation(Encapsulate fields) from:
public void setField(String field) {
this.field = field;
}
到
public MyClass setField(String field) {
this.field = field;
return this;
}
推荐答案
有些事你可以改变模板。制定者和吸气者不是其中之一。您可以投票选择功能请求 IDEA-28206允许自定义生成的getter / setter 。 工程师Dollery 是正确的,插入客户制定者&干将。但我不相信有任何会覆盖重构使用的模板。
Some things you can change the template for. The setters and getters is not one of them. You can vote for the feature request IDEA-28206 Allow customization of generated getter/setter. Engineer Dollery is correct that there are some plugins for inserting customer setters & getters. But I do not believe there are any that will override the template used by the refactoring.
这篇关于自定义IntelliJ IDEA中的代码生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!