Oneline Getter and Setter Java

已回答

So I have been looking all around the internet how to setup my getters and setters to output in oneline?

I have set simple methods in one line:

 

 

Also One-line methods

Version:

IntelliJ IDEA 2017.1.3
Build #IU-171.4424.56, built on May 12, 2017
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

 

So is this simple option even possible?

Thanks in advanced

0

Do you mean display or format? These are completely different things.

Simple property accessors option will affect it as well.

Please share the screenshot and the code to reproduce the problem.

0
Avatar
Permanently deleted user

When I generate a getter or/and setter I get this format:

public String getName() {
return this.name;
}

 

What I would like is:

public String getName() { return this.name; }

Because all my getters and setter are simple and it is not necessary for them to take 3 line, it really bloats my code when I have more than 5 fields.

0

Close file and open it again, IDE will collapse getters and setters like this:

Note that it affects only the visual representation, the code in file remains the same (multiple lines). Related request from 2005: https://youtrack.jetbrains.com/issue/IDEABKL-1549.

1
Avatar
Permanently deleted user

I know about the visual appeal :(

To bad, really strange that this simple option isn't implemented from 2005 :D

Nevertheless still the best editor and it has 10 000 other options... Really hope you implement this, take care!

0

请先登录再写评论。