net.sourceforge.pmd
Class AbstractRule

java.lang.Object
  extended bynet.sourceforge.pmd.ast.JavaParserVisitorAdapter
      extended bynet.sourceforge.pmd.AbstractRule
All Implemented Interfaces:
JavaParserVisitor, Rule
Direct Known Subclasses:
AccessorClassGenerationRule, AtLeastOneConstructorRule, AvoidCatchingThrowable, AvoidDeeplyNestedIfStmtsRule, AvoidDuplicateLiteralsRule, AvoidReassigningParametersRule, BeanMembersShouldSerializeRule, ClassNamingConventionsRule, CloseConnectionRule, ConstructorCallsOverridableMethodRule, CouplingBetweenObjectsRule, CyclomaticComplexityRule, DoubleCheckedLockingRule, DuplicateImportsRule, ExceptionSignatureDeclaration, ExceptionTypeChecking, IdempotentOperationsRule, ImportFromSamePackageRule, JUnitAssertionsShouldIncludeMessageRule, LooseCouplingRule, MethodNamingConventionsRule, NullAssignmentRule, OnlyOneReturnRule, PositionalIteratorRule, SimplifyBooleanReturnsRule, StatisticalRule, StringConcatenationRule, StringToStringRule, SuspiciousOctalEscapeRule, SymbolTableTestRule, UnnecessaryConversionTemporaryRule, UnusedFormalParameterRule, UnusedImportsRule, UnusedLocalVariableRule, UnusedPrivateFieldRule, UnusedPrivateMethodRule, UseSingletonRule, VariableNamingConventionsRule, XPathRule

public abstract class AbstractRule
extends JavaParserVisitorAdapter
implements Rule


Field Summary
private  java.lang.String description
           
private  java.lang.String example
           
private  boolean m_include
           
private  int m_priority
           
private  java.lang.String message
           
private  java.lang.String name
           
private  java.util.Properties properties
           
 
Fields inherited from interface net.sourceforge.pmd.Rule
LOWEST_PRIORITY, PRIORITIES
 
Constructor Summary
AbstractRule()
           
 
Method Summary
 void addProperty(java.lang.String name, java.lang.String value)
           
 void apply(java.util.List acus, RuleContext ctx)
           
 RuleViolation createRuleViolation(RuleContext ctx, int lineNumber)
           
 RuleViolation createRuleViolation(RuleContext ctx, int lineNumber, java.lang.String specificDescription)
           
 boolean equals(java.lang.Object o)
           
 boolean getBooleanProperty(java.lang.String name)
           
 java.lang.String getDescription()
           
 double getDoubleProperty(java.lang.String name)
           
 java.lang.String getExample()
           
 int getIntProperty(java.lang.String name)
           
 java.lang.String getMessage()
           
 java.lang.String getName()
           
 int getPriority()
          Returns the rule's priority that is used for including the rule in reports and analysis.
 java.lang.String getPriorityName()
          Returns the rule's priority name that is used for including the rule in reports and analysis.
 java.util.Properties getProperties()
          Gets an enumeration to enumerate through this rule's property names.
 java.lang.String getStringProperty(java.lang.String name)
           
 int hashCode()
           
 boolean hasProperty(java.lang.String name)
           
 boolean include()
          When the rule is to be included in the analysis, returns true; otherwise, returns false.
 void setDescription(java.lang.String description)
           
 void setExample(java.lang.String example)
           
 void setInclude(boolean include)
          When the rule is to be included in the analysis, set to true; otherwise, set to false.
 void setMessage(java.lang.String message)
           
 void setName(java.lang.String name)
           
 void setPriority(int priority)
          A rule will specify a priority for inclusion in reports and analysis.
protected  void visitAll(java.util.List acus, RuleContext ctx)
           
 
Methods inherited from class net.sourceforge.pmd.ast.JavaParserVisitorAdapter
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name

properties

private java.util.Properties properties

message

private java.lang.String message

description

private java.lang.String description

example

private java.lang.String example

m_include

private boolean m_include

m_priority

private int m_priority
Constructor Detail

AbstractRule

public AbstractRule()
Method Detail

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

getExample

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

setExample

public void setExample(java.lang.String example)
Specified by:
setExample 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

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

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

visitAll

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

apply

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

createRuleViolation

public RuleViolation createRuleViolation(RuleContext ctx,
                                         int lineNumber)

createRuleViolation

public RuleViolation createRuleViolation(RuleContext ctx,
                                         int lineNumber,
                                         java.lang.String specificDescription)

getProperties

public java.util.Properties getProperties()
Gets an enumeration to enumerate through this rule's property names.

Specified by:
getProperties in interface Rule
Returns:
An enumeration of property names

include

public boolean include()
When the rule is to be included in the analysis, returns true; otherwise, returns false.

Specified by:
include in interface Rule
Returns:
True when the rule is included in analysis.

setInclude

public void setInclude(boolean include)
When the rule is to be included in the analysis, set to true; otherwise, set to false.

Specified by:
setInclude in interface Rule
Parameters:
include - True when the rule is included in analysis.

getPriority

public int getPriority()
Returns the rule's priority that is used for including the rule in reports and analysis.

Specified by:
getPriority in interface Rule
Returns:
A number between 1 and LOWEST_PRIORITY.

getPriorityName

public java.lang.String getPriorityName()
Returns the rule's priority name that is used for including the rule in reports and analysis.

Specified by:
getPriorityName in interface Rule
Returns:
A member of PRIORITIES.

setPriority

public void setPriority(int priority)
A rule will specify a priority for inclusion in reports and analysis. The default priority is "Low".

Specified by:
setPriority in interface Rule