我很好奇是否可以选择按可见性而不是按字母对字段、方法等不同类型进行排序。我知道我可以使用Source -> Cleanup
. 但它也会按字母顺序对其进行排序。我只想按可见性排序并保留其余的旧顺序。
例子:
public class Person {
private Person(final Long id, final String name, final String surname) {
}
public Person() {
}
private Long id;
private String surname;
private String name;
public final static String SOME_CONSTANT = "SOME_CONSTANT";
}
排序后应该是这样的:
public class Person {
public final static String SOME_CONSTANT = "SOME_CONSTANT";
private Long id;
private String surname;
private String name;
public Person() {
}
private Person(final Long id, final String name, final String surname) {
}
}
但我得到:
public class Person {
public final static String SOME_CONSTANT = "SOME_CONSTANT";
private Long id;
private String name;
private String surname;
public Person() {
}
private Person(final Long id, final String name, final String surname) {
}
}