Interface ImportOrganizer

All Known Implementing Classes:
IdeaImportOrganizer

public interface ImportOrganizer
Organizes import statements when patching files.
  • Field Details

    • STATIC_FIRST_ORGANIZER

      static final ImportOrganizer STATIC_FIRST_ORGANIZER
      An ImportOrganizer that sorts import statements according to the Google Java Style Guide, i.e. static first, static and non-static separated by blank line.
    • STATIC_LAST_ORGANIZER

      static final ImportOrganizer STATIC_LAST_ORGANIZER
      An ImportOrganizer that sorts import statements so that non-static imports come first, and static and non-static separated by blank line.
    • ANDROID_STATIC_FIRST_ORGANIZER

      static final ImportOrganizer ANDROID_STATIC_FIRST_ORGANIZER
      An ImportOrganizer that sorts import statements according to Android Code Style, with static imports first.

      The imports are partitioned into groups in two steps, each step sub-partitions all groups from the previous step. The steps are:

      1. Split into static and non-static, the static imports come before the non static imports.
      2. The groups are then partitioned based on a prefix of the type, the groups are ordered by prefix as follows:
        1. android.
        2. com.android.
        3. A group for each root package, in alphabetical order.
        4. java.
        5. javax.
    • ANDROID_STATIC_LAST_ORGANIZER

      static final ImportOrganizer ANDROID_STATIC_LAST_ORGANIZER
      An ImportOrganizer that sorts import statements according to Android Code Style, with static imports last.

      The imports are partitioned into groups in two steps, each step sub-partitions all groups from the previous step. The steps are:

      1. Split into static and non-static, the static imports come after the non static imports.
      2. The groups are then partitioned based on a prefix of the type, the groups are ordered by prefix as follows:
        1. android.
        2. com.android.
        3. A group for each root package, in alphabetical order.
        4. java.
        5. javax.
    • IDEA_ORGANIZER

      static final ImportOrganizer IDEA_ORGANIZER
      An ImportOrganizer that organizes imports based on the default format provided by IntelliJ IDEA.

      This groups the imports into three groups, each delimited by a newline:

      1. Non-static, non-java.*, non-javax.* imports.
      2. javax.* and java.* imports, with javax.* imports ordered first.
      3. Static imports.
  • Method Details

    • organizeImports

      Organize the imports supplied, e.g. insert blank lines between various groups.
      Parameters:
      imports - the imports to organize, the order is undefined.
      Returns:
      the list of organized imports.