public abstract class AbstractRule extends AbstractPropertySource implements Rule
propertyDescriptors, propertyValuesByDescriptor
VIOLATION_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()
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, usesDefaultValues
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues
public void deepCopyValuesTo(AbstractRule otherRule)
public Language getLanguage()
Rule
getLanguage
in interface Rule
Rule.getLanguage()
public void setLanguage(Language language)
Rule
setLanguage
in interface Rule
Rule.setLanguage(Language)
public LanguageVersion getMinimumLanguageVersion()
Rule
null
it indicates there is no minimum bound.getMinimumLanguageVersion
in interface Rule
Rule.getMinimumLanguageVersion()
public void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
Rule
setMinimumLanguageVersion
in interface Rule
Rule.setMinimumLanguageVersion(LanguageVersion)
public LanguageVersion getMaximumLanguageVersion()
Rule
null
it indicates there is no maximum bound.getMaximumLanguageVersion
in interface Rule
Rule.getMaximumLanguageVersion()
public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
Rule
setMaximumLanguageVersion
in interface Rule
Rule.setMaximumLanguageVersion(LanguageVersion)
public boolean isDeprecated()
Rule
isDeprecated
in interface Rule
Rule.isDeprecated()
public void setDeprecated(boolean deprecated)
Rule
setDeprecated
in interface Rule
Rule.setDeprecated(boolean)
public String getName()
Rule
getName
in interface Rule
getName
in class AbstractPropertySource
Rule.getName()
public void setName(String name)
Rule
setName
in interface Rule
Rule.setName(String)
public String getSince()
Rule
null
if not applicable.getSince
in interface Rule
Rule.getSince()
public void setSince(String since)
Rule
setSince
in interface Rule
Rule.setSince(String)
public String getRuleClass()
Rule
getRuleClass
in interface Rule
Rule.getRuleClass()
public void setRuleClass(String ruleClass)
Rule
setRuleClass
in interface Rule
Rule.setRuleClass(String)
public String getRuleSetName()
Rule
getRuleSetName
in interface Rule
Rule.getRuleSetName()
public void setRuleSetName(String ruleSetName)
Rule
setRuleSetName
in interface Rule
Rule.setRuleSetName(String)
public String getMessage()
Rule
getMessage
in interface Rule
Rule.getMessage()
public void setMessage(String message)
Rule
setMessage
in interface Rule
Rule.setMessage(String)
public String getDescription()
Rule
getDescription
in interface Rule
Rule.getDescription()
public void setDescription(String description)
Rule
setDescription
in interface Rule
Rule.setDescription(String)
public List<String> getExamples()
Rule
getExamples
in interface Rule
Rule.getExamples()
public void addExample(String example)
Rule
addExample
in interface Rule
Rule.addExample(String)
public String getExternalInfoUrl()
Rule
getExternalInfoUrl
in interface Rule
Rule.getExternalInfoUrl()
public void setExternalInfoUrl(String externalInfoUrl)
Rule
setExternalInfoUrl
in interface Rule
Rule.setExternalInfoUrl(String)
public RulePriority getPriority()
Rule
getPriority
in interface Rule
Rule.getPriority()
public void setPriority(RulePriority priority)
Rule
setPriority
in interface Rule
Rule.setPriority(RulePriority)
public ParserOptions getParserOptions()
ParserOptions
using default settings.getParserOptions
in interface Rule
Rule.setPriority(RulePriority)
public void setUsesDFA()
Rule
setUsesDFA
in interface Rule
Rule.setUsesDFA()
public boolean usesDFA()
Rule
usesDFA
in interface Rule
Rule.usesDFA()
public void setUsesTypeResolution()
Rule
setUsesTypeResolution
in interface Rule
Rule.setUsesTypeResolution()
public boolean usesTypeResolution()
Rule
usesTypeResolution
in interface Rule
Rule.usesTypeResolution()
public boolean usesRuleChain()
Rule
usesRuleChain
in interface Rule
Rule.usesRuleChain()
public List<String> getRuleChainVisits()
Rule
getRuleChainVisits
in interface Rule
Rule.getRuleChainVisits()
public void addRuleChainVisit(Class<? extends Node> nodeClass)
Rule
addRuleChainVisit
in interface Rule
Rule.addRuleChainVisit(Class)
public void addRuleChainVisit(String astNodeName)
Rule
addRuleChainVisit
in interface Rule
Rule.addRuleChainVisit(String)
public void start(RuleContext ctx)
Rule
start
in interface Rule
Rule.start(RuleContext)
public void end(RuleContext ctx)
Rule
end
in interface Rule
Rule.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 Object
equals(Object)
Copyright © 2002–2013 InfoEther. All rights reserved.