http://www.jindent.com |
|
Next: Separator comments |
Use case-sensitive name sorting |
Sort type declarations |
See also: | Type declaration sorter tree |
Type declaration sorter tree |
enum Z㧬er { EINS, ZWEI, DREI };
)
| +- Annotation Types +- Enum Constants +- Enums +- Classes +- Interfaces |
enum Counter { ... } class DummyClass { ... } class AnotherTest { ... } public class Test { ... } interface InterfaceA { ... |
| +- Annotation Types +- Enum Constants +- Enums +- Classes | +- 1. Sort by Access Modifiers [x] | | +- public | | +- friendly | | | +- 2. Sort by Annotation Modifier [x] | | +- Non-Annotated | | +- Annotated | | | +- 3. Sort by Abstract Modifier [x] | | +- Abstract | | +- Non-Abstract | | | +- 4. Sort by Final Modifier [x] | | +- Final | | +- Non-Final | | | +- 5. Sort by Name [x] | +- 6. Sort by StrictFP Modifier [ ] | +- StrictFP | +- Non-SctrictFP | +- Interfaces |
enum Counter { ... } public class Test { ... } class AnotherTest { ... } class DummyClass { ... } interface InterfaceA { ... |
Insert separator comments before type declarations |
//~--- Class declarations ------------------------ public class MyClass { ... } class AnotherClass { ... } //~--- Interface declarations -------------------- interface MyInterface { ... } //~--- Enum declarations ------------------------- enum Counter { ... } |
//~
so that Jindent is able to recognize
and remove already inserted separator comments from previous Jindent sessions.See also: | Jindent - Settings - Formatter - Java / SQLJ - Sorting - Separator comments |
Insert separator comments only between type declarations |
public class MyClass { ... } class AnotherClass { ... } //~--- Interface declarations -------------------- interface MyInterface { ... } //~--- Enum declarations ------------------------- enum Counter { ... } |
Sort within class, interface and enum declarations |
See also: | Within type declaration sorter tree |
Within type declaration sorter tree |
enum Z㧬er { EINS, ZWEI, DREI };
)
| +- Static Fields +- Static Initializers +- Enum Constants +- Enums +- Fields +- Initializers +- Annotation Types +- Constructors +- Methods +- Inner Classes +- Inner Interfaces |
public class DummyClass { private static int fieldB; private static int fieldC; private static int fieldA; private static int CONST_1 = 1; private static int CONST_2 = 2; static { fieldB = 10; } private enum Counter { ONE, TWO, THREE }; private DummyClass(int i) { ... } public DummClass() { this(10); } public void methodC(String s) { ... } public int getB() { ... } public void methodA(int i) { ... } public int getA() { ... } class InnerClass { ... } } |
| +- Static Fields +- Static Initializers +- Enum Constants +- Enums +- Fields +- Initializers +- Annotation Types +- Constructors +- Methods | +- 1. Sort by Access Modifiers [x] | | +- public | | +- friendly | | +- protected | | +- private | | | +- 2. Sort by Method Type [x] | | +- Getters | | +- Has Getters | | +- Is Getters | | +- Setters | | +- Ordinary Methods | | | +- 3. Sort by Native Modifier [x] | | +- Native | | +- Non-Native | | | +- 4. Sort by Static Modifier [x] | | +- Static | | +- Non-Static | | | +- 5. Sort by Final Modifier [x] | | +- Final | | +- Non-Final | | | +- 6. Sort by Annotation Modifier [ ] | +- 7. Sort by Abstract Modifier [ ] | +- 8. Sort by Synchronized Modifier [ ] | +- 9. Sort by StrictFP Modifier [ ] | +- 10. Sort by Name [x] | +- 11. Sort by Parameter Count [x] | +- Inner Classes +- Inner Interfaces |
get
) would put before has getter methods
(methods with prefix has
) and so on...
public class DummyClass { private static int fieldB; private static int fieldC; private static int fieldA; private static int CONST_1 = 1; private static int CONST_2 = 2; static { fieldB = 10; } private enum Counter { ONE, TWO, THREE }; private DummyClass(int i) { ... } public DummClass() { this(10); } public int getA() { ... } public int getB() { ... } public void methodA(int i) { ... } public void methodC(String s) { ... } class InnerClass { ... } } |
public class Demo { private int fieldD; private int fieldB = 10; private int fieldC; private int fieldA = fieldB; ... } |
public class Demo { private int fieldA = fieldB; private int fieldB = 10; private int fieldC; private int fieldD; ... } |
fieldA
has an illegal forward reference
to fieldB
.
public class Demo { private int fieldB = 10; private int fieldA = fieldB; private int fieldC; private int fieldD; ... } |
fieldC
and fieldD
are sorted correctly but the initialized fields
fieldA
and fieldB
did not changed their relative sorting order.Insert separator comments before declarations within class, interface and enum declarations |
public class MyClass { //~ static field delcarations ----------------- public static int CONSTANT_1 = 1; public static int CONSTANT_2 = 2; //~ field delcarations ------------------------ private int fieldA; private int fieldB; //~ constructor delcarations ------------------ public MyClass() { ... } public MyClass(int i) { ... } //~ method delcarations ----------------------- public void methodA() { ... } public void methodB() { ... } public void methodC() { ... } } |
//~
so that Jindent is able to recognize
and remove already inserted separator comments from previous Jindent sessions.See also: | Jindent - Settings - Formatter - Java / SQLJ - Sorting - Separator comments |
Insert separator comments only between declarations within class, interface and enum declarations |
public class MyClass { public static int CONSTANT_1 = 1; public static int CONSTANT_2 = 2; //~ field delcarations ------------------------ private int fieldA; private int fieldB; //~ constructor delcarations ------------------ public MyClass() { ... } public MyClass(int i) { ... } //~ method delcarations ----------------------- public void methodA() { ... } public void methodB() { ... } public void methodC() { ... } } |
Insert separator comments within nested class, interface and enum declarations |
public class MyClass { class NestedClass { //~ field declarations --------------- int a, b, c; //~ constructor declarations --------- NestedClass() { ... } //~ method declarations -------------- public int getA() { ... } } } |
Sort import declarations |
See also: | Import declaration sorter tree |
Import declaration sorter tree |
| +- Imports | +- 1. Group by Package Names [x] | | +- java | | +- javax | | +- org | | +- com | | | +- 2. Sort by Modifiers [x] | | +- Static | | +- Non-Static | | | +- 3. Sort by Name [x] | +- 4. Group by Package Membership [ ] | | +- JDK Packages | | +- Non-JDK Packages | | |
package myPackage; import java.awt.peer.CheckboxMenuItemPeer; import java.awt.event.*; import java.io.ObjectOutputStream; import static aaa.bbb.MyClassA.*; import static aaa.bbb.MyClassB.compute; import java.io.ObjectInputStream; import aaa.bbb.MyClassD; import java.io.IOException; import static java.lang.Math.max; import aaa.bbb.ccc.*; import aaa.bbb.MyClassC; import static java.lang.Math.min; import java.awt.Color; import java.awt.Font; import javax.swing.JComponent; import javax.swing.border.*; public class ClassA { ... } |
package myPackage; import static java.lang.Math.max; import static java.lang.Math.min; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.awt.peer.CheckboxMenuItemPeer; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.swing.JComponent; import javax.swing.border.*; import static aaa.bbb.MyClassA.*; import static aaa.bbb.MyClassB.compute; import aaa.bbb.MyClassC; import aaa.bbb.MyClassD; import aaa.bbb.ccc.*; public class ClassA { ... } |
Insert separator comments before import declarations |
package myPackage; //~ Non JDK imports ------------------------------ import static aaa.bbb.MyClassA.*; import static aaa.bbb.MyClassB.compute; import aaa.bbb.MyClassC; import aaa.bbb.MyClassD; import aaa.bbb.ccc.*; //~ JDK imports ------------------------------ import static java.lang.Math.max; import static java.lang.Math.min; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.awt.peer.CheckboxMenuItemPeer; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.swing.JComponent; import javax.swing.border.*; public class ClassA { ... } |
//~
so that Jindent is able to recognize
and remove already inserted separator comments from previous Jindent sessions.See also: | Jindent - Settings - Formatter - Java / SQLJ - Sorting - Separator comments |
Insert separator comments only between import declarations |
package myPackage; import static aaa.bbb.MyClassA.*; import static aaa.bbb.MyClassB.compute; import aaa.bbb.MyClassC; import aaa.bbb.MyClassD; import aaa.bbb.ccc.*; //~ JDK imports ------------------------------ import static java.lang.Math.max; import static java.lang.Math.min; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.awt.peer.CheckboxMenuItemPeer; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.swing.JComponent; import javax.swing.border.*; public class ClassA { ... } |
Grouping depth of imported packages |
package myPackage; import aaa.bbb.MyClassC; import aaa.bbb.MyClassD; import aaa.bbb.ccc.*; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.awt.peer.CheckboxMenuItemPeer; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.swing.JComponent; import javax.swing.border.*; public class ClassA { ... } |
package myPackage; import aaa.bbb.MyClassC; import aaa.bbb.MyClassD; import aaa.bbb.ccc.*; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.awt.peer.CheckboxMenuItemPeer; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.swing.JComponent; import javax.swing.border.*; public class ClassA { ... } |
package myPackage; import aaa.bbb.MyClassC; import aaa.bbb.MyClassD; import aaa.bbb.ccc.*; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.awt.peer.CheckboxMenuItemPeer; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.swing.JComponent; import javax.swing.border.*; public class ClassA { ... } |
See also: | Blank lines around import declaration , Blank lines around static import declaration |
Blank lines around import declaration |
See also: | Grouping depth of imported packages |
Blank lines around static import declaration |
static
import declaration groups.See also: | Grouping depth of imported packages |