public abstract class AbstractXPathRuleQuery extends Object implements XPathRuleQuery
Modifier and Type | Field and Description |
---|---|
protected Map<PropertyDescriptor<?>,Object> |
properties
The properties.
|
protected List<String> |
ruleChainVisits
Subclasses can manage RuleChain visits via this list.
|
protected String |
version
The XPath version;
|
protected String |
xpath
The XPath query string.
|
XPATH_1_0, XPATH_1_0_COMPATIBILITY, XPATH_2_0
Constructor and Description |
---|
AbstractXPathRuleQuery() |
Modifier and Type | Method and Description |
---|---|
abstract List<Node> |
evaluate(Node node,
RuleContext data)
Evaluate the XPath query against the given Node.
|
List<String> |
getRuleChainVisits()
Indicates which AST Nodes (if any) should be used with the RuleChain.
|
protected abstract boolean |
isSupportedVersion(String version)
Subclasses should implement to indicate whether an XPath version is
supported.
|
void |
setProperties(Map<PropertyDescriptor<?>,Object> properties)
Set the properties to use during the XPath query.
|
void |
setVersion(String version)
Set the XPath version to be used.
|
void |
setXPath(String xpath)
Set the XPath query string to be used.
|
protected String xpath
protected String version
protected Map<PropertyDescriptor<?>,Object> properties
public void setXPath(String xpath)
setXPath
in interface XPathRuleQuery
xpath
- The XPath query string.public void setVersion(String version) throws UnsupportedOperationException
setVersion
in interface XPathRuleQuery
version
- The XPath version.UnsupportedOperationException
- if the version cannot be handled.protected abstract boolean isSupportedVersion(String version)
version
- The XPath version.true
if the XPath version is supported,
false
otherwise.public void setProperties(Map<PropertyDescriptor<?>,Object> properties)
setProperties
in interface XPathRuleQuery
public List<String> getRuleChainVisits()
getRuleChainVisits
in interface XPathRuleQuery
public abstract List<Node> evaluate(Node node, RuleContext data)
evaluate
in interface XPathRuleQuery
node
- The Node.data
- The RuleContext.Copyright © 2002–2017 PMD. All rights reserved.