beginTree
public void beginTree(DetailAST aRootAST)
Called before the starting to process a tree. Ideal place to initialise
information that is to be collected whilst processing a tree.
aRootAST
- the root of the tree
destroy
public void destroy()
Destroy the check. It is being retired from service.
finishTree
public void finishTree(DetailAST aRootAST)
Called after finished processing a tree. Ideal place to report on
information collected whilst processing a tree.
aRootAST
- the root of the tree
getAcceptableTokens
public int[] getAcceptableTokens()
The configurable token set.
Used to protect Checks against malicious users who specify an
unacceptable token set in the configuration file.
The default implementation returns the check's default tokens.
- the token set this check is designed for.
TokenTypes
getClassLoader
public final ClassLoader getClassLoader()
Returns the class loader associated with the tree.
- the class loader
getDefaultTokens
public int[] getDefaultTokens()
Returns the default token a check is interested in. Only used if the
configuration for a check does not define the tokens.
- the default tokens
TokenTypes
getFileContents
public final FileContents getFileContents()
Returns the file contents associated with the tree.
- the file contents
getLines
public final String[] getLines()
Returns the lines associated with the tree.
- the file contents
getRequiredTokens
public int[] getRequiredTokens()
The tokens that this check must be registered for.
- the token set this must be registered for.
TokenTypes
getTabWidth
protected final int getTabWidth()
- the tab width to report errors with
getTokenNames
public final Set getTokenNames()
Returns the tokens registered for the check.
- the set of token names
init
public void init()
Initialse the check. This is the time to verify that the check has
everything required to perform it job.
leaveToken
public void leaveToken(DetailAST aAST)
Called after all the child nodes have been process.
aAST
- the token leaving
log
protected final void log(int aLine,
String aKey,
aArgs[] )
Log an error message.
- log in interface AbstractViolationReporter
aLine
- the line number where the error was foundaKey
- the message that describes the error
java.text.MessageFormat
log
protected final void log(int aLineNo,
int aColNo,
String aKey,
Object[] aArgs)
Helper method to log a LocalizedMessage.
- log in interface AbstractViolationReporter
aLineNo
- line number to associate with the messageaColNo
- column number to associate with the messageaKey
- key to locale message formataArgs
- arguments for message
setClassLoader
public final void setClassLoader(ClassLoader aLoader)
Set the class loader associated with the tree.
aLoader
- the class loader
setFileContents
public final void setFileContents(FileContents aContents)
Set the file contents associated with the tree.
aContents
- the manager
setMessages
public final void setMessages(LocalizedMessages aMessages)
Set the global object used to collect messages.
aMessages
- the messages to log with
setTabWidth
public final void setTabWidth(int aTabWidth)
Set the tab width to report errors with.
aTabWidth
- an int
value
setTokens
public final void setTokens(String[] aStrRep)
Adds a set of tokens the check is interested in.
aStrRep
- the string representation of the tokens interested in
visitToken
public void visitToken(DetailAST aAST)
Called to process a token.
aAST
- the token to process