net.sourceforge.pmd

Class CommonAbstractRule

public abstract class CommonAbstractRule extends Object implements Rule

Basic abstract implementation of all parser-independent methods of the Rule interface.

Author: pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be

Field Summary
protected Stringdescription
protected Stringexample
protected StringexternalInfoUrl
protected booleaninclude
protected Stringmessage
protected Stringname
protected intpriority
protected Propertiesproperties
protected StringruleSetName
protected booleanusesDFA
Method Summary
voidaddProperties(Properties properties)
voidaddProperty(String name, String value)
protected voidaddViolation(Object data, SimpleNode node)
Adds a violation to the report.
protected voidaddViolation(Object data, SimpleNode node, String embed)
Adds a violation to the report.
protected voidaddViolation(Object data, Node node, Object[] args)
Adds a violation to the report.
protected voidaddViolationWithMessage(Object data, SimpleNode node, String msg)
Adds a violation to the report.
booleanequals(Object o)
Test if rules are equals.
booleangetBooleanProperty(String name)
StringgetDescription()
doublegetDoubleProperty(String name)
StringgetExample()
StringgetExternalInfoUrl()
intgetIntProperty(String name)
StringgetMessage()
StringgetName()
intgetPriority()
StringgetPriorityName()
PropertiesgetProperties()
StringgetRuleSetName()
StringgetStringProperty(String name)
inthashCode()
Return a hash code to conform to equality.
booleanhasProperty(String name)
booleaninclude()
voidsetDescription(String description)
voidsetExample(String example)
voidsetExternalInfoUrl(String url)
voidsetInclude(boolean include)
voidsetMessage(String message)
voidsetName(String name)
voidsetPriority(int priority)
voidsetRuleSetName(String ruleSetName)
voidsetUsesDFA()
booleanusesDFA()

Field Detail

description

protected String description

example

protected String example

externalInfoUrl

protected String externalInfoUrl

include

protected boolean include

message

protected String message

name

protected String name

priority

protected int priority

properties

protected Properties properties

ruleSetName

protected String ruleSetName

usesDFA

protected boolean usesDFA

Method Detail

addProperties

public void addProperties(Properties properties)

addProperty

public void addProperty(String name, String value)

addViolation

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

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

addViolation

protected final void addViolation(Object data, SimpleNode node, 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(Object data, Node node, 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

addViolationWithMessage

protected final void addViolationWithMessage(Object data, SimpleNode node, 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

equals

public boolean equals(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

getBooleanProperty

public boolean getBooleanProperty(String name)

getDescription

public String getDescription()

getDoubleProperty

public double getDoubleProperty(String name)

getExample

public String getExample()

getExternalInfoUrl

public String getExternalInfoUrl()

getIntProperty

public int getIntProperty(String name)

getMessage

public String getMessage()

getName

public String getName()

getPriority

public int getPriority()

getPriorityName

public String getPriorityName()

getProperties

public Properties getProperties()

getRuleSetName

public String getRuleSetName()

getStringProperty

public String getStringProperty(String name)

hashCode

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

hasProperty

public boolean hasProperty(String name)

include

public boolean include()

setDescription

public void setDescription(String description)

setExample

public void setExample(String example)

setExternalInfoUrl

public void setExternalInfoUrl(String url)

setInclude

public void setInclude(boolean include)

setMessage

public void setMessage(String message)

setName

public void setName(String name)

setPriority

public void setPriority(int priority)

setRuleSetName

public void setRuleSetName(String ruleSetName)

setUsesDFA

public void setUsesDFA()

usesDFA

public boolean usesDFA()