public abstract class AbstractCheck extends AbstractViolationReporter
AutomaticBean.OutputStreamOptions| Constructor and Description |
|---|
AbstractCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
void |
clearMessages()
Clears the sorted set of
LocalizedMessage of the check. |
void |
destroy()
Destroy the check.
|
void |
finishTree(DetailAST rootAST)
Called after finished processing a tree.
|
abstract int[] |
getAcceptableTokens()
The configurable token set.
|
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.
|
String |
getLine(int index)
Returns the line associated with the tree.
|
String[] |
getLines()
Returns the lines associated with the tree.
|
SortedSet<LocalizedMessage> |
getMessages()
Returns the sorted set of
LocalizedMessage. |
abstract int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
protected int |
getTabWidth()
Get tab width to report errors with.
|
Set<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(DetailAST ast,
String key,
Object... args)
Helper method to log a LocalizedMessage.
|
void |
log(int lineNo,
int colNo,
String key,
Object... args)
Log a message that has column information.
|
void |
log(int line,
String key,
Object... args)
Log a message that has no column information.
|
void |
setClassLoader(ClassLoader classLoader)
Set the class loader associated with the tree.
|
void |
setFileContents(FileContents contents)
Set the file contents associated with the tree.
|
void |
setTabWidth(int tabWidth)
Set the tab width to report errors with.
|
void |
setTokens(String... strRep)
Adds a set of tokens the check is interested in.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic AbstractCheck()
public abstract int[] getDefaultTokens()
TokenTypespublic abstract int[] getAcceptableTokens()
TokenTypespublic abstract int[] getRequiredTokens()
TokenTypespublic boolean isCommentNodesRequired()
public final void setTokens(String... strRep)
strRep - the string representation of the tokens interested inpublic final Set<String> getTokenNames()
public SortedSet<LocalizedMessage> getMessages()
LocalizedMessage.LocalizedMessage.public final void clearMessages()
LocalizedMessage of the check.public 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 String[] getLines()
public final String getLine(int index)
index - index of the linepublic final void setFileContents(FileContents contents)
contents - the managerpublic final FileContents getFileContents()
public final void setClassLoader(ClassLoader classLoader)
classLoader - the class loaderpublic final ClassLoader getClassLoader()
protected final int getTabWidth()
public final void setTabWidth(int tabWidth)
tabWidth - an int valuepublic final void log(DetailAST ast, String key, Object... args)
ast - a node to get line id column numbers associated
with the messagekey - key to locale message formatargs - arguments to formatpublic final void log(int line, String key, 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, String key, 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 messageMessageFormatCopyright © 2001–2018. All rights reserved.