Interface ImportOrganizer
- All Known Implementing Classes:
IdeaImportOrganizer
public interface ImportOrganizer
Organizes import statements when patching files.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Represents an import.static class
Provides support for building a list of imports from groups and formatting it as a block of imports. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ImportOrganizer
AnImportOrganizer
that sorts import statements according to Android Code Style, with static imports first.static final ImportOrganizer
AnImportOrganizer
that sorts import statements according to Android Code Style, with static imports last.static final ImportOrganizer
AnImportOrganizer
that organizes imports based on the default format provided by IntelliJ IDEA.static final ImportOrganizer
AnImportOrganizer
that sorts import statements according to the Google Java Style Guide, i.e.static final ImportOrganizer
AnImportOrganizer
that sorts import statements so that non-static imports come first, and static and non-static separated by blank line. -
Method Summary
Modifier and TypeMethodDescriptionorganizeImports
(List<ImportOrganizer.Import> imports) Organize the imports supplied, e.g.
-
Field Details
-
STATIC_FIRST_ORGANIZER
AnImportOrganizer
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
AnImportOrganizer
that sorts import statements so that non-static imports come first, and static and non-static separated by blank line. -
ANDROID_STATIC_FIRST_ORGANIZER
AnImportOrganizer
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:
- Split into static and non-static, the static imports come before the non static imports.
- The groups are then partitioned based on a prefix of the type, the groups are ordered by
prefix as follows:
android.
com.android.
- A group for each root package, in alphabetical order.
java.
javax.
-
ANDROID_STATIC_LAST_ORGANIZER
AnImportOrganizer
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:
- Split into static and non-static, the static imports come after the non static imports.
- The groups are then partitioned based on a prefix of the type, the groups are ordered by
prefix as follows:
android.
com.android.
- A group for each root package, in alphabetical order.
java.
javax.
-
IDEA_ORGANIZER
AnImportOrganizer
that organizes imports based on the default format provided by IntelliJ IDEA.This groups the imports into three groups, each delimited by a newline:
- Non-static, non-
java.*
, non-javax.*
imports. javax.*
andjava.*
imports, withjavax.*
imports ordered first.- Static imports.
- Non-static, non-
-
-
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.
-