In IntelliJ you can generate getter and setter methods for your Java class fields. The problem I have is that by our code conventions private fields need to start with an underscore, for example:
private String _name;
IntelliJ will generated the following getter and setter methods for this field:
public String get_reportName()
{
return _reportName;
}
public void set_reportName(String _reportName)
{
this._reportName = _reportName;
}
I would like it to rather generate:
public String getReportName()
{
return _reportName;
}
public void setReportName(String reportName)
{
_reportName = reportName;
}
Can I somehow customize the generation code to achieve this?
Thanks
Open IntelliJ Preferences (Command + , on Mac).
Navigate through:
Editor
-- Code Style
---- Java
Select the Code Generation
tab. Under Name prefix:
put an underscore in the Field:
text box. Now, it should work for you. (At least in IntelliJ 15 where I tested this).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With