IntelliJ getter/setter format (single-line versus multi-line)
I'm using IntelliJ IDEA 14.1.0 and you can customise this behaviour.
Just use the "Generate..." option, or use Alt+Insert shortcut, and select "Getter and Setter".
In the "Select Fields" window that gets opened, you have the "Getter Template" option at the top. Use the "..." button next to the dropdown, to edit the template.
Select "IntelliJ Default" and click the "Copy" button to create a new one named "AlwayStartWithGet", which you can edit.
Just remove the following section:
#if ($field.boolean)
#if ($StringUtil.startsWithIgnoreCase($name, 'is'))
#set($name = $StringUtil.decapitalize($name))
#else
is##
#end
#else
get##
#end
And replace it with a simple
get##
You should be left with:
public ##
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
get##
${name}() {
return $field.name;
}
Now you can use the custom template when generating code, by selecting it in the getter template dropdown.
For Idea 2016.
Getter template
Merge the last 3 lines into a single line:
${name}() { return $field.name; }
Setter template
Add double hash (without a space) at the end of the longest line:
[...] ($field.type, $paramName) {##
Merge the last 2 lines into a single line:
$field.name = $paramName; }
Note: as commented by @mindas, you will probably want instead the visual auto folding that doesn't get versioned.