public class ImportOrderCheck extends Check
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.
Compatible with Java 1.5 source.Constructor and Description |
---|
ImportOrderCheck()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTree(DetailAST aRootAST)
Called before the starting to process a tree.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
setCaseSensitive(boolean aCaseSensitive)
Sets whether string comparision should be case sensitive
or not.
|
void |
setGroups(String[] aGroups)
sets the list of package groups and the order they should
occur in the file.
|
void |
setOrdered(boolean aOrdered)
Sets whether or not imports should be ordered within any one
group of imports.
|
void |
setSeparated(boolean aSeparated)
Sets whether or not groups of imports must be separated from
one another by at least one blank line.
|
void |
visitToken(DetailAST aAST)
Called to process a token.
|
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public void setGroups(String[] aGroups)
aGroups
- a comma-separated list of package names/prefixespublic void setOrdered(boolean aOrdered)
aOrdered
- whether lexicographic ordering of imports within
a group required or not.public void setSeparated(boolean aSeparated)
aSeparated
- whehter groups should be separated by blank line.public void setCaseSensitive(boolean aCaseSensitive)
aCaseSensitive
- whether string comparision should be
case sensitive.public int[] getDefaultTokens()
getDefaultTokens
in class Check
TokenTypes
public int[] getRequiredTokens()
getRequiredTokens
in class Check
TokenTypes
public void beginTree(DetailAST aRootAST)
public void visitToken(DetailAST aAST)
visitToken
in class Check
aAST
- the token to process