【发布时间】:2019-03-29 16:29:39
【问题描述】:
我想在 Intellij 的 toString 代码生成中使用 getter。在 IDE 设置中,我选择了选项 Enable getters in code generation ($methods),但它不起作用。如何配置 Intellij 来实现这一点?
【问题讨论】:
标签: intellij-idea code-generation tostring
我想在 Intellij 的 toString 代码生成中使用 getter。在 IDE 设置中,我选择了选项 Enable getters in code generation ($methods),但它不起作用。如何配置 Intellij 来实现这一点?
【问题讨论】:
标签: intellij-idea code-generation tostring
如果 IntelliJ 可以直接访问该字段,它似乎不提供您使用 getter。但如果它们被重命名,它会列出你的吸气剂:
String myField;
public String getMyField() { return myField; } // will not be listed in toString generation
public String pleaseGetMyField() { return myField; } // will be listed in toString generation
【讨论】: