JALOPY | Java Source Code Formatter Beautifier Pretty Printer
Overview • Download • Documentation • Plug-ins • Links • Contact
Features | History | Manual | FAQ | Javadoc
This page generated: June 8 2004
4.3.12. Sorting
Prev | 4.3. Printer | Next
- ### 4.3.12. Sorting Lets you tweak the sorting settings. #### 4.3.12.1. Declarations At first glance, sorting of class declaration elements may seem somewhat obscure, but good sorting can lead to a reduction of complexity if the location of each element is predictable. Sort class elements Enables or disables the sorting of class elements. Example 4.149. Sorted Java source file (with Separator comments)
      class TypePrinter
          extends AbstractPrinter
      {
          //~ Instance/static variables ----------------------------------------------

          /** Singleton. */
          private final static Printer INSTANCE = new TypePrinter();

          //~ Constructors -----------------------------------------------------------

          /**
           * Creates a new TypePrinter object.
           */
          protected TypePrinter()
          {
          }

          //~ Methods ----------------------------------------------------------------

          public static Printer getInstance()
          {
              return INSTANCE;
          }

          public void print(AST node, ASTWriter out)
                     throws IOException
          {
              AST child = node.getFirstChild();
              PrinterFactory.create(child).print(child, out);
          }
      }
Ordering You can specify the order in which static variable/initializer, instance variable, instance initializer, constructor, method, inner class and interface elements should appear in source files by selecting the element type and moving it up or down the list. If you enable any of the check boxes, all elements of the selected type (within a section) will be sorted too. First by access modifier (public, protected, package protected, private) and - for two elements with the same accessibility - lexicographically. For methods those which follow the Java Bean pattern (getXXX, setXXX, isXXX) will be sorted first. #### 4.3.12.2. Modifiers Enables or disables the sorting of declaration modifiers. Ordering Lets you specify the order in which the individual modifiers should appear. Select an entry and use the Up and Down buttons to move it to the desired location.
Prev | Up | Next
4.3.11. Footer | Home | 4.3.13. Misc
to top