|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.pmd.AbstractPropertySource
net.sourceforge.pmd.lang.rule.AbstractRule
public abstract class AbstractRule
Basic abstract implementation of all parser-independent methods of the Rule interface.
| Field Summary |
|---|
| Fields inherited from class net.sourceforge.pmd.AbstractPropertySource |
|---|
propertyDescriptors, propertyValuesByDescriptor |
| Fields inherited from interface net.sourceforge.pmd.Rule |
|---|
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR |
| Constructor Summary | |
|---|---|
AbstractRule()
|
|
| Method Summary | |
|---|---|
void |
addExample(String example)
Add a single example for this Rule. |
void |
addRuleChainVisit(Class<? extends Node> nodeClass)
Adds an AST node by class to be visited by the Rule on the RuleChain. |
void |
addRuleChainVisit(String astNodeName)
Adds an AST node by name to be visited by the Rule on the RuleChain. |
void |
addViolation(Object data,
Node node)
|
void |
addViolation(Object data,
Node node,
Object[] args)
|
void |
addViolation(Object data,
Node node,
String arg)
|
void |
addViolationWithMessage(Object data,
Node node,
String message)
|
void |
addViolationWithMessage(Object data,
Node node,
String message,
int beginLine,
int endLine)
|
void |
addViolationWithMessage(Object data,
Node node,
String message,
Object[] args)
|
void |
deepCopyValuesTo(AbstractRule otherRule)
|
void |
end(RuleContext ctx)
End processing. |
boolean |
equals(Object o)
Rules are equal if: They have the same implementation class. They have the same name. They have the same priority. They share the same properties. |
String |
getDescription()
Get the description of this Rule. |
List<String> |
getExamples()
Get the list of examples for this Rule. |
String |
getExternalInfoUrl()
Get a URL for external information about this Rule. |
Language |
getLanguage()
Get the Language of this Rule. |
LanguageVersion |
getMaximumLanguageVersion()
Get the maximum LanguageVersion to which this Rule applies. |
String |
getMessage()
Get the message to show when this Rule identifies a violation. |
LanguageVersion |
getMinimumLanguageVersion()
Get the minimum LanguageVersion to which this Rule applies. |
String |
getName()
Gets the name of the property source. |
ParserOptions |
getParserOptions()
This implementation returns a new instance of ParserOptions using default settings. |
RulePriority |
getPriority()
Get the priority of this Rule. |
List<String> |
getRuleChainVisits()
Gets the collection of AST node names visited by the Rule on the RuleChain. |
String |
getRuleClass()
Get the implementation class of this Rule. |
String |
getRuleSetName()
Get the name of the RuleSet containing this Rule. |
String |
getSince()
Get the version of PMD in which this Rule was added. |
int |
hashCode()
|
boolean |
isDeprecated()
Gets whether this Rule is deprecated. |
void |
setDeprecated(boolean deprecated)
Sets whether this Rule is deprecated. |
void |
setDescription(String description)
Set the description of this Rule. |
void |
setExternalInfoUrl(String externalInfoUrl)
Set a URL for external information about this Rule. |
void |
setLanguage(Language language)
Set the Language of this Rule. |
void |
setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
Set the maximum LanguageVersion to which this Rule applies. |
void |
setMessage(String message)
Set the message to show when this Rule identifies a violation. |
void |
setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
Set the minimum LanguageVersion to which this Rule applies. |
void |
setName(String name)
Set the name of this Rule. |
void |
setPriority(RulePriority priority)
Set the priority of this Rule. |
void |
setRuleClass(String ruleClass)
Set the class of this Rule. |
void |
setRuleSetName(String ruleSetName)
Set the name of the RuleSet containing this Rule. |
void |
setSince(String since)
Set the version of PMD in which this Rule was added. |
void |
setUsesDFA()
Sets whether this Rule uses Data Flow Analysis. |
void |
setUsesTypeResolution()
Sets whether this Rule uses Type Resolution. |
void |
start(RuleContext ctx)
Start processing. |
boolean |
usesDFA()
Gets whether this Rule uses Data Flow Analysis. |
boolean |
usesRuleChain()
Gets whether this Rule uses the RuleChain. |
boolean |
usesTypeResolution()
Gets whether this Rule uses Type Resolution. |
| Methods inherited from class net.sourceforge.pmd.AbstractPropertySource |
|---|
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sourceforge.pmd.Rule |
|---|
apply |
| Methods inherited from interface net.sourceforge.pmd.PropertySource |
|---|
definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues |
| Constructor Detail |
|---|
public AbstractRule()
| Method Detail |
|---|
public void deepCopyValuesTo(AbstractRule otherRule)
public Language getLanguage()
Rule
getLanguage in interface RuleRule.getLanguage()public void setLanguage(Language language)
Rule
setLanguage in interface Rulelanguage - the languageRule.setLanguage(net.sourceforge.pmd.lang.Language)public LanguageVersion getMinimumLanguageVersion()
Rulenull it indicates there is no minimum bound.
getMinimumLanguageVersion in interface RuleRule.getMinimumLanguageVersion()public void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
Rule
setMinimumLanguageVersion in interface RuleminimumLanguageVersion - the minimum language versionRule.setMinimumLanguageVersion(net.sourceforge.pmd.lang.LanguageVersion)public LanguageVersion getMaximumLanguageVersion()
Rulenull it indicates there is no maximum bound.
getMaximumLanguageVersion in interface RuleRule.getMaximumLanguageVersion()public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
Rule
setMaximumLanguageVersion in interface RulemaximumLanguageVersion - the maximum language versionRule.setMaximumLanguageVersion(net.sourceforge.pmd.lang.LanguageVersion)public boolean isDeprecated()
Rule
isDeprecated in interface Ruletrue if this rule is deprecatedRule.isDeprecated()public void setDeprecated(boolean deprecated)
Rule
setDeprecated in interface Ruledeprecated - whether this rule is deprecatedRule.setDeprecated(boolean)public String getName()
AbstractPropertySource
getName in interface RulegetName in class AbstractPropertySourceRule.getName()public void setName(String name)
Rule
setName in interface Rulename - the nameRule.setName(String)public String getSince()
Rulenull if not applicable.
getSince in interface RuleRule.getSince()public void setSince(String since)
Rule
setSince in interface Rulesince - the version of PMD since when this rule was addedRule.setSince(String)public String getRuleClass()
Rule
getRuleClass in interface RuleRule.getRuleClass()public void setRuleClass(String ruleClass)
Rule
setRuleClass in interface RuleruleClass - the class name of this rule.Rule.setRuleClass(String)public String getRuleSetName()
Rule
getRuleSetName in interface RuleRule.getRuleSetName()public void setRuleSetName(String ruleSetName)
Rule
setRuleSetName in interface RuleruleSetName - the name of the ruleset containing this rule.Rule.setRuleSetName(String)public String getMessage()
Rule
getMessage in interface RuleRule.getMessage()public void setMessage(String message)
Rule
setMessage in interface Rulemessage - the message to show for a violation.Rule.setMessage(String)public String getDescription()
Rule
getDescription in interface RuleRule.getDescription()public void setDescription(String description)
Rule
setDescription in interface Ruledescription - the descriptionRule.setDescription(String)public List<String> getExamples()
Rule
getExamples in interface RuleRule.getExamples()public void addExample(String example)
Rule
addExample in interface Ruleexample - a single example to addRule.addExample(String)public String getExternalInfoUrl()
Rule
getExternalInfoUrl in interface RuleRule.getExternalInfoUrl()public void setExternalInfoUrl(String externalInfoUrl)
Rule
setExternalInfoUrl in interface RuleexternalInfoUrl - the URL for external information about this rule.Rule.setExternalInfoUrl(String)public RulePriority getPriority()
Rule
getPriority in interface RuleRule.getPriority()public void setPriority(RulePriority priority)
Rule
setPriority in interface Rulepriority - the priorityRule.setPriority(RulePriority)public ParserOptions getParserOptions()
ParserOptions using default settings.
getParserOptions in interface RuleRule.setPriority(RulePriority)public void setUsesDFA()
Rule
setUsesDFA in interface RuleRule.setUsesDFA()public boolean usesDFA()
Rule
usesDFA in interface Ruletrue if Data Flow Analysis is used.Rule.usesDFA()public void setUsesTypeResolution()
Rule
setUsesTypeResolution in interface RuleRule.setUsesTypeResolution()public boolean usesTypeResolution()
Rule
usesTypeResolution in interface Ruletrue if Type Resolution is used.Rule.usesTypeResolution()public boolean usesRuleChain()
Rule
usesRuleChain in interface Ruletrue if RuleChain is used.Rule.usesRuleChain()public List<String> getRuleChainVisits()
Rule
getRuleChainVisits in interface RuleRule.getRuleChainVisits()public void addRuleChainVisit(Class<? extends Node> nodeClass)
Rule
addRuleChainVisit in interface RulenodeClass - the AST node to add to the RuleChain visit listRule.addRuleChainVisit(Class)public void addRuleChainVisit(String astNodeName)
Rule
addRuleChainVisit in interface RuleastNodeName - the AST node to add to the RuleChain visit list as
stringRule.addRuleChainVisit(String)public void start(RuleContext ctx)
Rule
start in interface Rulectx - the rule contextRule.start(RuleContext)public void end(RuleContext ctx)
Rule
end in interface Rulectx - the rule contextRule.end(RuleContext)
public void addViolation(Object data,
Node node)
RuleViolationFactory.addViolation(RuleContext, Rule, Node, String, Object[])
public void addViolation(Object data,
Node node,
String arg)
RuleViolationFactory.addViolation(RuleContext, Rule, Node, String, Object[])
public void addViolation(Object data,
Node node,
Object[] args)
RuleViolationFactory.addViolation(RuleContext, Rule, Node, String, Object[])
public void addViolationWithMessage(Object data,
Node node,
String message)
RuleViolationFactory.addViolation(RuleContext, Rule, Node, String, Object[])
public void addViolationWithMessage(Object data,
Node node,
String message,
int beginLine,
int endLine)
RuleViolationFactory.addViolation(RuleContext, Rule, Node, String, Object[])
public void addViolationWithMessage(Object data,
Node node,
String message,
Object[] args)
RuleViolationFactory.addViolation(RuleContext, Rule, Node, String, Object[])public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectequals(Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||