net.sourceforge.pmd.rules
Class XPathRule

java.lang.Object
  extended by net.sourceforge.pmd.CommonAbstractRule
      extended by net.sourceforge.pmd.AbstractJavaRule
          extended by net.sourceforge.pmd.rules.XPathRule
All Implemented Interfaces:
JavaParserVisitor, Rule

public class XPathRule
extends AbstractJavaRule

Rule that tries to match an XPath expression against a DOM view of the AST of a "compilation unit".

This rule needs a property "xpath".


Field Summary
 
Fields inherited from interface net.sourceforge.pmd.Rule
LOWEST_PRIORITY, PRIORITIES
 
Constructor Summary
XPathRule()
           
 
Method Summary
 void apply(java.util.List astCompilationUnits, RuleContext ctx)
          Apply the rule to all compilation units.
 void evaluate(Node compilationUnit, RuleContext data)
          Evaluate the AST with compilationUnit as root-node, against the XPath expression found as property with name "xpath".
 java.util.List<java.lang.String> getRuleChainVisits()
          Gets the collection of AST node names visited by the Rule on the RuleChain.
 
Methods inherited from class net.sourceforge.pmd.AbstractJavaRule
addViolation, addViolation, addViolation, addViolationWithMessage, getDeclaringType, importsPackage, isQualifiedName, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll
 
Methods inherited from class net.sourceforge.pmd.CommonAbstractRule
addExample, addProperties, addProperty, addRuleChainVisit, asFixedMap, asFixedMap, end, equals, getBooleanProperties, getBooleanProperty, getBooleanProperty, getDescription, getDoubleProperties, getDoubleProperty, getDoubleProperty, getExample, getExamples, getExternalInfoUrl, getIntProperties, getIntProperty, getIntProperty, getMessage, getName, getPriority, getPriorityName, getProperties, getRuleClass, getRuleSetName, getSince, getStringProperties, getStringProperty, getStringProperty, getTypeProperties, getTypeProperty, hashCode, hasProperty, include, propertiesByName, propertyDescriptorFor, setDescription, setExternalInfoUrl, setInclude, setMessage, setName, setPriority, setProperties, setProperty, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, start, usesDFA, usesRuleChain, usesTypeResolution
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathRule

public XPathRule()
Method Detail

evaluate

public void evaluate(Node compilationUnit,
                     RuleContext data)
Evaluate the AST with compilationUnit as root-node, against the XPath expression found as property with name "xpath". All matches are reported as violations.

Parameters:
compilationUnit - the Node that is the root of the AST to be checked
data -

getRuleChainVisits

public java.util.List<java.lang.String> getRuleChainVisits()
Description copied from interface: Rule
Gets the collection of AST node names visited by the Rule on the RuleChain.

Specified by:
getRuleChainVisits in interface Rule
Overrides:
getRuleChainVisits in class CommonAbstractRule

apply

public void apply(java.util.List astCompilationUnits,
                  RuleContext ctx)
Apply the rule to all compilation units.

Specified by:
apply in interface Rule
Overrides:
apply in class AbstractJavaRule


Copyright © 2002-2011 InfoEther. All Rights Reserved.