public abstract class AbstractXPathRuleQuery extends java.lang.Object implements XPathRuleQuery
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<PropertyDescriptor<?>,java.lang.Object> |
properties
The properties.
|
protected java.util.List<java.lang.String> |
ruleChainVisits
Subclasses can manage RuleChain visits via this list.
|
protected java.lang.String |
version
The XPath version;
|
protected java.lang.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 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.
|
protected abstract boolean |
isSupportedVersion(java.lang.String version)
Subclasses should implement to indicate whether an XPath version is
supported.
|
void |
setProperties(java.util.Map<PropertyDescriptor<?>,java.lang.Object> properties)
Set the properties to use during the XPath query.
|
void |
setVersion(java.lang.String version)
Set the XPath version to be used.
|
void |
setXPath(java.lang.String xpath)
Set the XPath query string to be used.
|
protected java.lang.String xpath
protected java.lang.String version
protected java.util.Map<PropertyDescriptor<?>,java.lang.Object> properties
protected final java.util.List<java.lang.String> ruleChainVisits
public void setXPath(java.lang.String xpath)
setXPath
in interface XPathRuleQuery
xpath
- The XPath query string.public void setVersion(java.lang.String version) throws java.lang.UnsupportedOperationException
setVersion
in interface XPathRuleQuery
version
- The XPath version.java.lang.UnsupportedOperationException
- if the version cannot be handled.protected abstract boolean isSupportedVersion(java.lang.String version)
version
- The XPath version.true
if the XPath version is supported,
false
otherwise.public void setProperties(java.util.Map<PropertyDescriptor<?>,java.lang.Object> properties)
setProperties
in interface XPathRuleQuery
public java.util.List<java.lang.String> getRuleChainVisits()
getRuleChainVisits
in interface XPathRuleQuery
public abstract java.util.List<Node> evaluate(Node node, RuleContext data)
evaluate
in interface XPathRuleQuery
node
- The Node.data
- The RuleContext.Copyright © 2002–2018 PMD. All rights reserved.