public abstract class AbstractCheck extends AbstractViolationReporter
| Modifier and Type | Field and Description |
|---|---|
private java.lang.ClassLoader |
classLoader
The class loader to load external classes.
|
private static int |
DEFAULT_TAB_WIDTH
Default tab width for column reporting.
|
private FileContents |
fileContents
The current file contents.
|
private LocalizedMessages |
messages
The object for collecting messages.
|
private int |
tabWidth
The tab width for column reporting.
|
private java.util.Set<java.lang.String> |
tokens
The tokens the check is interested in.
|
| Constructor and Description |
|---|
AbstractCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
void |
destroy()
Destroy the check.
|
void |
finishTree(DetailAST rootAST)
Called after finished processing a tree.
|
abstract int[] |
getAcceptableTokens()
The configurable token set.
|
java.lang.ClassLoader |
getClassLoader()
Returns the class loader associated with the tree.
|
abstract int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
FileContents |
getFileContents()
Returns the file contents associated with the tree.
|
java.lang.String |
getLine(int index)
Returns the line associated with the tree.
|
java.lang.String[] |
getLines()
Returns the lines associated with the tree.
|
abstract int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
protected int |
getTabWidth()
Get tab width to report errors with.
|
java.util.Set<java.lang.String> |
getTokenNames()
Returns the tokens registered for the check.
|
void |
init()
Initialize the check.
|
boolean |
isCommentNodesRequired()
Whether comment nodes are required or not.
|
void |
leaveToken(DetailAST ast)
Called after all the child nodes have been process.
|
void |
log(int lineNo,
int colNo,
java.lang.String key,
java.lang.Object... args)
Log a message that has column information.
|
void |
log(int line,
java.lang.String key,
java.lang.Object... args)
Log a message that has no column information.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader associated with the tree.
|
void |
setFileContents(FileContents contents)
Set the file contents associated with the tree.
|
void |
setMessages(LocalizedMessages messages)
Set the global object used to collect messages.
|
void |
setTabWidth(int tabWidth)
Set the tab width to report errors with.
|
void |
setTokens(java.lang.String... strRep)
Adds a set of tokens the check is interested in.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildprivate static final int DEFAULT_TAB_WIDTH
private final java.util.Set<java.lang.String> tokens
private FileContents fileContents
private LocalizedMessages messages
private int tabWidth
private java.lang.ClassLoader classLoader
public abstract int[] getDefaultTokens()
TokenTypespublic abstract int[] getAcceptableTokens()
TokenTypespublic abstract int[] getRequiredTokens()
TokenTypespublic boolean isCommentNodesRequired()
public final void setTokens(java.lang.String... strRep)
strRep - the string representation of the tokens interested inpublic final java.util.Set<java.lang.String> getTokenNames()
public final void setMessages(LocalizedMessages messages)
messages - the messages to log withpublic void init()
public void destroy()
public void beginTree(DetailAST rootAST)
rootAST - the root of the treepublic void finishTree(DetailAST rootAST)
rootAST - the root of the treepublic void visitToken(DetailAST ast)
ast - the token to processpublic void leaveToken(DetailAST ast)
ast - the token leavingpublic final java.lang.String[] getLines()
public final java.lang.String getLine(int index)
index - index of the linepublic final void setFileContents(FileContents contents)
contents - the managerpublic final FileContents getFileContents()
public final void setClassLoader(java.lang.ClassLoader classLoader)
classLoader - the class loaderpublic final java.lang.ClassLoader getClassLoader()
protected final int getTabWidth()
public final void setTabWidth(int tabWidth)
tabWidth - an int valuepublic final void log(int line,
java.lang.String key,
java.lang.Object... args)
AbstractViolationReporterlog in class AbstractViolationReporterline - the line number where the error was foundkey - the message that describes the errorargs - the details of the messageMessageFormatpublic final void log(int lineNo,
int colNo,
java.lang.String key,
java.lang.Object... args)
AbstractViolationReporterlog in class AbstractViolationReporterlineNo - the line number where the error was foundcolNo - the column number where the error was foundkey - the message that describes the errorargs - the details of the messageMessageFormat