net.sourceforge.pmd.jsp.rules
Class AbstractJspRule

java.lang.Object
  extended by net.sourceforge.pmd.jsp.ast.JspParserVisitorAdapter
      extended by net.sourceforge.pmd.jsp.rules.AbstractJspRule
All Implemented Interfaces:
JspParserVisitor, Rule
Direct Known Subclasses:
DuplicateJspImports, NoInlineStyleInformation

public abstract class AbstractJspRule
extends JspParserVisitorAdapter
implements Rule


Field Summary
 
Fields inherited from interface net.sourceforge.pmd.Rule
LOWEST_PRIORITY, PRIORITIES
 
Constructor Summary
AbstractJspRule()
           
 
Method Summary
 void addExample(java.lang.String example)
           
 void addProperties(java.util.Properties properties)
           
 void addProperty(java.lang.String name, java.lang.String value)
           
 void addRuleChainVisit(java.lang.String astNodeName)
           
protected  void addViolation(java.lang.Object data, Node node, java.lang.Object[] args)
          Adds a violation to the report.
protected  void addViolation(java.lang.Object data, SimpleNode node)
          Adds a violation to the report.
protected  void addViolation(java.lang.Object data, SimpleNode node, java.lang.String embed)
          Adds a violation to the report.
protected  void addViolationWithMessage(java.lang.Object data, SimpleNode node, java.lang.String msg)
          Adds a violation to the report.
 void apply(java.util.List acus, RuleContext ctx)
           
 boolean equals(java.lang.Object o)
          Test if rules are equals.
 boolean getBooleanProperty(java.lang.String name)
           
 java.lang.String getDescription()
           
 double getDoubleProperty(java.lang.String name)
           
 java.lang.String getExample()
          Deprecated. use getExamples(), since we now support multiple examples
 java.util.List<java.lang.String> getExamples()
           
 java.lang.String getExternalInfoUrl()
           
 int getIntProperty(java.lang.String name)
           
 java.lang.String getMessage()
           
 java.lang.String getName()
           
 int getPriority()
           
 java.lang.String getPriorityName()
           
 java.util.Properties getProperties()
           
 java.util.List<java.lang.String> getRuleChainVisits()
           
 java.lang.String getRuleSetName()
           
 java.lang.String getStringProperty(java.lang.String name)
           
 int hashCode()
          Return a hash code to conform to equality.
 boolean hasProperty(java.lang.String name)
           
 boolean include()
           
 PropertyDescriptor propertyDescriptorFor(java.lang.String name)
           
 void setDescription(java.lang.String description)
           
 void setExternalInfoUrl(java.lang.String url)
           
 void setInclude(boolean include)
           
 void setMessage(java.lang.String message)
           
 void setName(java.lang.String name)
           
 void setPriority(int priority)
           
 void setRuleSetName(java.lang.String ruleSetName)
           
 void setUsesDFA()
           
 void setUsesTypeResolution()
           
 boolean usesDFA()
           
 boolean usesRuleChain()
           
 boolean usesTypeResolution()
           
protected  void visitAll(java.util.List acus, RuleContext ctx)
           
 
Methods inherited from class net.sourceforge.pmd.jsp.ast.JspParserVisitorAdapter
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJspRule

public AbstractJspRule()
Method Detail

getRuleSetName

public java.lang.String getRuleSetName()
Specified by:
getRuleSetName in interface Rule

setRuleSetName

public void setRuleSetName(java.lang.String ruleSetName)
Specified by:
setRuleSetName in interface Rule

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface Rule

setDescription

public void setDescription(java.lang.String description)
Specified by:
setDescription in interface Rule

getExamples

public java.util.List<java.lang.String> getExamples()
Specified by:
getExamples in interface Rule

getExample

public java.lang.String getExample()
Deprecated. use getExamples(), since we now support multiple examples

Still used by the JDeveloper plugin

Specified by:
getExample in interface Rule

addExample

public void addExample(java.lang.String example)
Specified by:
addExample in interface Rule

hasProperty

public boolean hasProperty(java.lang.String name)
Specified by:
hasProperty in interface Rule

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)
Specified by:
addProperty in interface Rule

addProperties

public void addProperties(java.util.Properties properties)
Specified by:
addProperties in interface Rule

getDoubleProperty

public double getDoubleProperty(java.lang.String name)
Specified by:
getDoubleProperty in interface Rule

getIntProperty

public int getIntProperty(java.lang.String name)
Specified by:
getIntProperty in interface Rule

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
Specified by:
getBooleanProperty in interface Rule

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
Specified by:
getStringProperty in interface Rule

getName

public java.lang.String getName()
Specified by:
getName in interface Rule

setName

public void setName(java.lang.String name)
Specified by:
setName in interface Rule

getMessage

public java.lang.String getMessage()
Specified by:
getMessage in interface Rule

setMessage

public void setMessage(java.lang.String message)
Specified by:
setMessage in interface Rule

getExternalInfoUrl

public java.lang.String getExternalInfoUrl()
Specified by:
getExternalInfoUrl in interface Rule

setExternalInfoUrl

public void setExternalInfoUrl(java.lang.String url)
Specified by:
setExternalInfoUrl in interface Rule

equals

public boolean equals(java.lang.Object o)
Test if rules are equals. Rules are equals if 1. they have the same implementation class 2. they have the same name 3. they have the same priority 4. they share the same properties/values

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Return a hash code to conform to equality. Try with a string.

Overrides:
hashCode in class java.lang.Object

apply

public void apply(java.util.List acus,
                  RuleContext ctx)
Specified by:
apply in interface Rule

getProperties

public java.util.Properties getProperties()
Specified by:
getProperties in interface Rule

include

public boolean include()
Specified by:
include in interface Rule

setInclude

public void setInclude(boolean include)
Specified by:
setInclude in interface Rule

getPriority

public int getPriority()
Specified by:
getPriority in interface Rule

getPriorityName

public java.lang.String getPriorityName()
Specified by:
getPriorityName in interface Rule

setPriority

public void setPriority(int priority)
Specified by:
setPriority in interface Rule

setUsesDFA

public void setUsesDFA()
Specified by:
setUsesDFA in interface Rule

usesDFA

public boolean usesDFA()
Specified by:
usesDFA in interface Rule

setUsesTypeResolution

public void setUsesTypeResolution()
Specified by:
setUsesTypeResolution in interface Rule

usesTypeResolution

public boolean usesTypeResolution()
Specified by:
usesTypeResolution in interface Rule

visitAll

protected void visitAll(java.util.List acus,
                        RuleContext ctx)

addViolation

protected final void addViolation(java.lang.Object data,
                                  SimpleNode node)
Adds a violation to the report.

Parameters:
ctx - the RuleContext
node - the node that produces the violation

addViolationWithMessage

protected final void addViolationWithMessage(java.lang.Object data,
                                             SimpleNode node,
                                             java.lang.String msg)
Adds a violation to the report.

Parameters:
ctx - the RuleContext
node - the node that produces the violation
msg - specific message to put in the report

addViolation

protected final void addViolation(java.lang.Object data,
                                  SimpleNode node,
                                  java.lang.String embed)
Adds a violation to the report.

Parameters:
ctx - the RuleContext
node - the node that produces the violation
embed - a variable to embed in the rule violation message

addViolation

protected final void addViolation(java.lang.Object data,
                                  Node node,
                                  java.lang.Object[] args)
Adds a violation to the report.

Parameters:
ctx - the RuleContext
node - the node that produces the violation, may be null, in which case all line and column info will be set to zero
args - objects to embed in the rule violation message

propertyDescriptorFor

public PropertyDescriptor propertyDescriptorFor(java.lang.String name)
Specified by:
propertyDescriptorFor in interface Rule

usesRuleChain

public boolean usesRuleChain()
Specified by:
usesRuleChain in interface Rule

getRuleChainVisits

public java.util.List<java.lang.String> getRuleChainVisits()
Specified by:
getRuleChainVisits in interface Rule

addRuleChainVisit

public void addRuleChainVisit(java.lang.String astNodeName)
Specified by:
addRuleChainVisit in interface Rule