net.sourceforge.pmd.rules
Class XPathRule

java.lang.Object
  extended bynet.sourceforge.pmd.CommonAbstractRule
      extended bynet.sourceforge.pmd.rules.XPathRule
All Implemented Interfaces:
Rule

public class XPathRule
extends CommonAbstractRule

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 class net.sourceforge.pmd.CommonAbstractRule
description, example, externalInfoUrl, include, message, name, priority, properties, ruleSetName, usesDFA, usesTypeResolution
 
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".
static java.lang.Class loadClass(java.lang.ClassLoader classloader, java.lang.String xpath, java.lang.String name)
           
 
Methods inherited from class net.sourceforge.pmd.CommonAbstractRule
addProperties, addProperty, addViolation, addViolation, addViolation, addViolationWithMessage, equals, getBooleanProperty, getDescription, getDoubleProperty, getExample, getExternalInfoUrl, getIntProperty, getMessage, getName, getPriority, getPriorityName, getProperties, getRuleSetName, getStringProperty, hashCode, hasProperty, include, propertyDescriptorFor, setDescription, setExample, setExternalInfoUrl, setInclude, setMessage, setName, setPriority, setRuleSetName, setUsesDFA, setUsesTypeResolution, usesDFA, usesTypeResolution
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathRule

public XPathRule()
Method Detail

loadClass

public static java.lang.Class loadClass(java.lang.ClassLoader classloader,
                                        java.lang.String xpath,
                                        java.lang.String name)

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 -

apply

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



Copyright © 2002-2006 InfoEther. All Rights Reserved.