PropertySource
, Rule
public class XPathRule extends AbstractRule
This rule needs a "xpath" property value in order to function.
Modifier and Type | Field | Description |
---|---|---|
static EnumeratedProperty<java.lang.String> |
VERSION_DESCRIPTOR |
|
static StringProperty |
XPATH_DESCRIPTOR |
propertyDescriptors, propertyValuesByDescriptor
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
Constructor | Description |
---|---|
XPathRule() |
Creates a new XPathRule without the corresponding XPath query.
|
XPathRule(java.lang.String xPath) |
Creates a new XPathRule and associates the XPath query.
|
Modifier and Type | Method | Description |
---|---|---|
void |
apply(java.util.List<? extends Node> nodes,
RuleContext ctx) |
Apply the rule to all nodes.
|
java.lang.String |
dysfunctionReason() |
Returns a description of why the receiver may be dysfunctional.
|
void |
evaluate(Node node,
RuleContext data) |
Evaluate the XPath query with the AST node.
|
java.util.List<java.lang.String> |
getRuleChainVisits() |
Gets the collection of AST node names visited by the Rule on the
RuleChain.
|
void |
setVersion(java.lang.String version) |
|
void |
setXPath(java.lang.String xPath) |
Sets the XPath to query against the desired nodes in
apply(List, RuleContext) . |
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
addExample, addRuleChainVisit, addRuleChainVisit, addViolation, addViolation, addViolation, addViolationWithMessage, addViolationWithMessage, addViolationWithMessage, deepCopy, deepCopyValuesTo, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getRuleClass, getRuleSetName, getSince, hashCode, isDeprecated, isDfa, isMultifile, isRuleChain, isTypeResolution, setDeprecated, setDescription, setDfa, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setMultifile, setName, setPriority, setRuleClass, setRuleSetName, setSince, setTypeResolution, setUsesDFA, setUsesMultifile, setUsesTypeResolution, start, usesDFA, usesMultifile, usesRuleChain, usesTypeResolution
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
definePropertyDescriptor, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
public static final StringProperty XPATH_DESCRIPTOR
public static final EnumeratedProperty<java.lang.String> VERSION_DESCRIPTOR
public XPathRule()
public XPathRule(java.lang.String xPath)
public void setXPath(java.lang.String xPath)
apply(List, RuleContext)
.xPath
- the XPath querypublic void setVersion(java.lang.String version)
public void apply(java.util.List<? extends Node> nodes, RuleContext ctx)
nodes
- the nodesctx
- the rule contextpublic void evaluate(Node node, RuleContext data)
node
- The Node that to be checked.data
- The RuleContext.public java.util.List<java.lang.String> getRuleChainVisits()
Rule
getRuleChainVisits
in interface Rule
getRuleChainVisits
in class AbstractRule
public java.lang.String dysfunctionReason()
PropertySource
dysfunctionReason
in interface PropertySource
dysfunctionReason
in class AbstractPropertySource
Copyright © 2002–2018 PMD. All rights reserved.