Home | Manual |
This page generated: 20120315-0623

Lets you tweak the sorting settings.

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

    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.

to top