Search code examples
android-studiointellij-ideaentitygetter-settercode-formatting

Is there any plugin for Intellij (Android Studio) where Entity Code is formatted as Properties and Getters and Setters separately?


Is there any plugin for Intellij (Android Studio) where Entity Code is formatted as Properties and Getters and Setters separately?

Input:

public class Employee {
    private String name;
    private String department;
    // Getters and Setters
    private String employeeId;
    // Getters and setters
}

Output:

public class Employee {
    private String name;
    private String department;
    private String employeeId;
    // Getters and setters
}

Solution

  • Shift+Ctrl+Alt+L while in the Editor brings up the Reformat File dialog. There, you can choose to 'Rearrange code'. It should do the trick.

    enter image description here