com.puppycrawl.tools.checkstyle.checks.imports
Class ImportOrderCheck
- Configurable, Contextualizable
public class ImportOrderCheck
Class to check the ordering/grouping of imports. Ensures that
groups of imports come in a specific order (e.g., java. comes
first, javax. comes first, then everything else) and imports
within each group are in lexicographic order.
Example:
<module name="ImportOrder">
<property name="groups" value="java,javax"/>
<property name="ordered" value="true"/>
<property name="caseSensitive" value="false"/>
</module>
There is always an additional, implied "everything else" package
group. If no "groups" property is supplied, all imports belong in
this "everything else" group.
ordered defaults to true.
separated defaults to false.
- Bill Schneider
- o_sukhodolsky
beginTree , destroy , finishTree , getAcceptableTokens , getClassLoader , getDefaultTokens , getFileContents , getLines , getRequiredTokens , getTabWidth , getTokenNames , init , leaveToken , log , log , setClassLoader , setFileContents , setMessages , setTabWidth , setTokens , visitToken |
getMessageBundle , getSeverity , getSeverityLevel , log , log , log , log , log , log , log , log , log , log , log , setSeverity |
ImportOrderCheck
public ImportOrderCheck()
Default constructor.
beginTree
public void beginTree(DetailAST aRootAST)
- beginTree in interface Check
getDefaultTokens
public int[] getDefaultTokens()
- getDefaultTokens in interface Check
getRequiredTokens
public int[] getRequiredTokens()
- getRequiredTokens in interface Check
setCaseSensitive
public void setCaseSensitive(boolean aCaseSensitive)
Sets whether strings comprision should be case sensitive
or not.
aCaseSensitive
- whether string comprition should be
case sensitive.
setGroups
public void setGroups(String[] aGroups)
sets the list of package groups and the order they should
occur in the file.
aGroups
- a comma-separated list of package names/prefixes
setOrdered
public void setOrdered(boolean aOrdered)
Sets whether or not imports should be ordered within any one
group of imports.
aOrdered
- whether lexicographic ordering of imports within
a group required or not.
setSeparated
public void setSeparated(boolean aSeparated)
Sets whether or not groups of imports must be separated from
one another by at least one blank line.
aSeparated
- whehter groups should be separated by blank line.
visitToken
public void visitToken(DetailAST aAST)
- visitToken in interface Check