Control over format of getter/setter generation

I'm wondering if there is a way to control the format that is used when IDEA generates getter/setter pairs for me. For example, if I'm generating getter/setter pairs for two members (foo and bar), I'd like it to look like this:

public void setFoo(Foo foo) { = foo; }
public Foo getFoo() { return; }

public void setBar(Bar bar) { = bar; }
public Bar getBar() { return; }

So basically, one method == one line, and no space between the getter/setter pair, but a line between each pair. Right now, it generates each getter/setter over three lines and with white space between each method.

Is there a way I can control this currently? Or do I need to log a feature request for a mechanism to do this. Thanks,


Comment actions Permalink

People have asked for this capability for a long time...

It still find it very strange that such an advanced IDE uses hard-coded templates for this.

Comment actions Permalink

there are all kinds of options for when IntelliJ puts newlines into code. They are in the Global Code Settings .. alignments and Braces.. there's a checkbox there that says "simple methods in one line".... that might do it for you...

You have to poke around a little in the settings Global Code Settings dialog box.. there's a lot there under different tabs...

Comment actions Permalink

Thanks, I was looking for that.


Please sign in to leave a comment.