public abstract class AbstractRule extends AbstractPropertySource implements Rule
propertyDescriptors, propertyValuesByDescriptorVIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR| Constructor and Description |
|---|
AbstractRule() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValuesclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitdefinePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValuespublic void deepCopyValuesTo(AbstractRule otherRule)
public Language getLanguage()
RulegetLanguage in interface RuleRule.getLanguage()public void setLanguage(Language language)
RulesetLanguage in interface Rulelanguage - the languageRule.setLanguage(Language)public LanguageVersion getMinimumLanguageVersion()
Rulenull it indicates there is no minimum bound.getMinimumLanguageVersion in interface RuleRule.getMinimumLanguageVersion()public void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
RulesetMinimumLanguageVersion in interface RuleminimumLanguageVersion - the minimum language versionRule.setMinimumLanguageVersion(LanguageVersion)public LanguageVersion getMaximumLanguageVersion()
Rulenull it indicates there is no maximum bound.getMaximumLanguageVersion in interface RuleRule.getMaximumLanguageVersion()public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
RulesetMaximumLanguageVersion in interface RulemaximumLanguageVersion - the maximum language versionRule.setMaximumLanguageVersion(LanguageVersion)public boolean isDeprecated()
RuleisDeprecated in interface Ruletrue if this rule is deprecatedRule.isDeprecated()public void setDeprecated(boolean deprecated)
RulesetDeprecated in interface Ruledeprecated - whether this rule is deprecatedRule.setDeprecated(boolean)public String getName()
AbstractPropertySourcegetName in interface RulegetName in class AbstractPropertySourceRule.getName()public void setName(String name)
RulesetName in interface Rulename - the nameRule.setName(String)public String getSince()
Rulenull if not applicable.getSince in interface RuleRule.getSince()public void setSince(String since)
RulesetSince in interface Rulesince - the version of PMD since when this rule was addedRule.setSince(String)public String getRuleClass()
RulegetRuleClass in interface RuleRule.getRuleClass()public void setRuleClass(String ruleClass)
RulesetRuleClass in interface RuleruleClass - the class name of this rule.Rule.setRuleClass(String)public String getRuleSetName()
RulegetRuleSetName in interface RuleRule.getRuleSetName()public void setRuleSetName(String ruleSetName)
RulesetRuleSetName in interface RuleruleSetName - the name of the ruleset containing this rule.Rule.setRuleSetName(String)public String getMessage()
RulegetMessage in interface RuleRule.getMessage()public void setMessage(String message)
RulesetMessage in interface Rulemessage - the message to show for a violation.Rule.setMessage(String)public String getDescription()
RulegetDescription in interface RuleRule.getDescription()public void setDescription(String description)
RulesetDescription in interface Ruledescription - the descriptionRule.setDescription(String)public List<String> getExamples()
RulegetExamples in interface RuleRule.getExamples()public void addExample(String example)
RuleaddExample in interface Ruleexample - a single example to addRule.addExample(String)public String getExternalInfoUrl()
RulegetExternalInfoUrl in interface RuleRule.getExternalInfoUrl()public void setExternalInfoUrl(String externalInfoUrl)
RulesetExternalInfoUrl in interface RuleexternalInfoUrl - the URL for external information about this rule.Rule.setExternalInfoUrl(String)public RulePriority getPriority()
RulegetPriority in interface RuleRule.getPriority()public void setPriority(RulePriority priority)
RulesetPriority in interface Rulepriority - the priorityRule.setPriority(RulePriority)public ParserOptions getParserOptions()
ParserOptions using default settings.getParserOptions in interface RuleRule.setPriority(RulePriority)public void setUsesDFA()
RulesetUsesDFA in interface RuleRule.setUsesDFA()public boolean usesDFA()
RuleusesDFA in interface Ruletrue if Data Flow Analysis is used.Rule.usesDFA()public void setUsesTypeResolution()
RulesetUsesTypeResolution in interface RuleRule.setUsesTypeResolution()public boolean usesTypeResolution()
RuleusesTypeResolution in interface Ruletrue if Type Resolution is used.Rule.usesTypeResolution()public boolean usesRuleChain()
RuleusesRuleChain in interface Ruletrue if RuleChain is used.Rule.usesRuleChain()public List<String> getRuleChainVisits()
RulegetRuleChainVisits in interface RuleRule.getRuleChainVisits()public void addRuleChainVisit(Class<? extends Node> nodeClass)
RuleaddRuleChainVisit in interface RulenodeClass - the AST node to add to the RuleChain visit listRule.addRuleChainVisit(Class)public void addRuleChainVisit(String astNodeName)
RuleaddRuleChainVisit in interface RuleastNodeName - the AST node to add to the RuleChain visit list as
stringRule.addRuleChainVisit(String)public void start(RuleContext ctx)
Rulestart in interface Rulectx - the rule contextRule.start(RuleContext)public void end(RuleContext ctx)
Ruleend in interface Rulectx - the rule contextRule.end(RuleContext)public void addViolationWithMessage(Object data, Node node, String message, int beginLine, int endLine)
public void addViolationWithMessage(Object data, Node node, String message, Object[] args)
public boolean equals(Object o)
public int hashCode()
hashCode in class Objectequals(Object)Copyright © 2002-2014 InfoEther. All Rights Reserved.