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.
|
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()
Get the name of this Rule.
|
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 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 RuleRule.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 RuleRule.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 RuleRule.setMaximumLanguageVersion(LanguageVersion)public boolean isDeprecated()
RuleisDeprecated in interface RuleRule.isDeprecated()public void setDeprecated(boolean deprecated)
RulesetDeprecated in interface RuleRule.setDeprecated(boolean)public String getName()
RulegetName in interface RulegetName in class AbstractPropertySourceRule.getName()public void setName(String name)
RulesetName in interface RuleRule.setName(String)public String getSince()
Rulenull if not applicable.getSince in interface RuleRule.getSince()public void setSince(String since)
RulesetSince in interface RuleRule.setSince(String)public String getRuleClass()
RulegetRuleClass in interface RuleRule.getRuleClass()public void setRuleClass(String ruleClass)
RulesetRuleClass in interface RuleRule.setRuleClass(String)public String getRuleSetName()
RulegetRuleSetName in interface RuleRule.getRuleSetName()public void setRuleSetName(String ruleSetName)
RulesetRuleSetName in interface RuleRule.setRuleSetName(String)public String getMessage()
RulegetMessage in interface RuleRule.getMessage()public void setMessage(String message)
RulesetMessage in interface RuleRule.setMessage(String)public String getDescription()
RulegetDescription in interface RuleRule.getDescription()public void setDescription(String description)
RulesetDescription in interface RuleRule.setDescription(String)public List<String> getExamples()
RulegetExamples in interface RuleRule.getExamples()public void addExample(String example)
RuleaddExample in interface RuleRule.addExample(String)public String getExternalInfoUrl()
RulegetExternalInfoUrl in interface RuleRule.getExternalInfoUrl()public void setExternalInfoUrl(String externalInfoUrl)
RulesetExternalInfoUrl in interface RuleRule.setExternalInfoUrl(String)public RulePriority getPriority()
RulegetPriority in interface RuleRule.getPriority()public void setPriority(RulePriority priority)
RulesetPriority in interface RuleRule.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 RuleRule.usesDFA()public void setUsesTypeResolution()
RulesetUsesTypeResolution in interface RuleRule.setUsesTypeResolution()public boolean usesTypeResolution()
RuleusesTypeResolution in interface RuleRule.usesTypeResolution()public boolean usesRuleChain()
RuleusesRuleChain in interface RuleRule.usesRuleChain()public List<String> getRuleChainVisits()
RulegetRuleChainVisits in interface RuleRule.getRuleChainVisits()public void addRuleChainVisit(Class<? extends Node> nodeClass)
RuleaddRuleChainVisit in interface RuleRule.addRuleChainVisit(Class)public void addRuleChainVisit(String astNodeName)
RuleaddRuleChainVisit in interface RuleRule.addRuleChainVisit(String)public void start(RuleContext ctx)
Rulestart in interface RuleRule.start(RuleContext)public void end(RuleContext ctx)
Ruleend in interface RuleRule.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-2013 InfoEther. All Rights Reserved.