java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.Check
com.puppycrawl.tools.checkstyle.checks.xpath.XPathCheck
- All Implemented Interfaces:
- com.puppycrawl.tools.checkstyle.api.Configurable, com.puppycrawl.tools.checkstyle.api.Contextualizable
- public class XPathCheck
- extends com.puppycrawl.tools.checkstyle.api.Check
Checks for an XPath in the root AST. Path elements are named
according to token types. Attributes of an element are bean
properties.
Requires jaxen, http://jaxen.sourceforge.net and
saxpath, http://sourceforge.net/projects/saxpath/.
Idea shamelessly stolen from the equivalent PMD rule (pmd.sourceforge.net).
| Fields inherited from class com.puppycrawl.tools.checkstyle.api.Check |
|
| Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
|
| Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mXPath
private XPath mXPath
- XPath for this check
mMessage
private java.lang.String mMessage
- error message
XPathCheck
public XPathCheck()
getDefaultTokens
public int[] getDefaultTokens()
- Description copied from class:
com.puppycrawl.tools.checkstyle.api.Check
- Returns the default token a check is interested in. Only used if the
configuration for a check does not define the tokens.
beginTree
public void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
- Description copied from class:
com.puppycrawl.tools.checkstyle.api.Check
- Called before the starting to process a tree. Ideal place to initialise
information that is to be collected whilst processing a tree.
setMessage
public void setMessage(java.lang.String aMessage)
- Sets the error message for this check.
setXPath
public void setXPath(java.lang.String aXPath)
throws JaxenException
- Sets the XPath for this check.