I am trying to add the final keyword to the parameters in my auto-generated setters in IntelliJ IDEA 14. I know that I can create a copy of the current template which is used for setter methods:
#set($paramName = $helper.getParamName($field, $project))
public ##
#if($field.modifierStatic)
static ##
#end
void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
#if ($field.name == $paramName)
#if (!$field.modifierStatic)
this.##
#else
$classname.##
#end
#end
$field.name = $paramName;
}
But even after playing around with it for hours, I can't work out how to add "final" to it and get it to work in IntelliJ.
You don't need to do this with templates.
Go to Settings (Windows: Ctrl+Alt+S) / Preferences (Mac: Command+,)
Editor | Code Style | Java
Make generated parameters final
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