Class JaxenXPathRuleQuery
- java.lang.Object
-
- net.sourceforge.pmd.lang.rule.xpath.AbstractXPathRuleQuery
-
- net.sourceforge.pmd.lang.rule.xpath.JaxenXPathRuleQuery
-
- All Implemented Interfaces:
XPathRuleQuery
public class JaxenXPathRuleQuery extends AbstractXPathRuleQuery
This is a Jaxen based XPathRule query.
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.lang.rule.xpath.AbstractXPathRuleQuery
properties, ruleChainVisits, version, xpath
-
Fields inherited from interface net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery
XPATH_1_0, XPATH_1_0_COMPATIBILITY, XPATH_2_0
-
-
Constructor Summary
Constructors Constructor Description JaxenXPathRuleQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Node>
evaluate(Node node, RuleContext data)
Evaluate the XPath query against the given Node.java.util.List<java.lang.String>
getRuleChainVisits()
Indicates which AST Nodes (if any) should be used with the RuleChain.boolean
isSupportedVersion(java.lang.String version)
Subclasses should implement to indicate whether an XPath version is supported.-
Methods inherited from class net.sourceforge.pmd.lang.rule.xpath.AbstractXPathRuleQuery
setProperties, setVersion, setXPath
-
-
-
-
Method Detail
-
isSupportedVersion
public boolean isSupportedVersion(java.lang.String version)
Description copied from class:AbstractXPathRuleQuery
Subclasses should implement to indicate whether an XPath version is supported.- Specified by:
isSupportedVersion
in classAbstractXPathRuleQuery
- Parameters:
version
- The XPath version.- Returns:
true
if the XPath version is supported,false
otherwise.
-
evaluate
public java.util.List<Node> evaluate(Node node, RuleContext data)
Description copied from interface:XPathRuleQuery
Evaluate the XPath query against the given Node.- Specified by:
evaluate
in interfaceXPathRuleQuery
- Specified by:
evaluate
in classAbstractXPathRuleQuery
- Parameters:
node
- The Node.data
- The RuleContext.- Returns:
- The matching Nodes.
-
getRuleChainVisits
public java.util.List<java.lang.String> getRuleChainVisits()
Description copied from interface:XPathRuleQuery
Indicates which AST Nodes (if any) should be used with the RuleChain. Use of the RuleChain will allow the query execute on a targed sub-tree of the AST, instead of the entire AST from the root. This can result in great performance benefits.- Specified by:
getRuleChainVisits
in interfaceXPathRuleQuery
- Overrides:
getRuleChainVisits
in classAbstractXPathRuleQuery
-
-