PropertySource
, Rule
public abstract class AbstractRule extends AbstractPropertySource implements Rule
propertyDescriptors, propertyValuesByDescriptor
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
Constructor | Description |
---|---|
AbstractRule() |
Modifier and Type | Method | Description |
---|---|---|
void |
addExample(java.lang.String example) |
Add a single example for this Rule.
|
void |
addRuleChainVisit(java.lang.Class<? extends Node> nodeClass) |
Adds an AST node by class to be visited by the Rule on the RuleChain.
|
void |
addRuleChainVisit(java.lang.String astNodeName) |
Adds an AST node by name to be visited by the Rule on the RuleChain.
|
void |
addViolation(java.lang.Object data,
Node node) |
|
void |
addViolation(java.lang.Object data,
Node node,
java.lang.Object[] args) |
|
void |
addViolation(java.lang.Object data,
Node node,
java.lang.String arg) |
|
void |
addViolationWithMessage(java.lang.Object data,
Node node,
java.lang.String message) |
|
void |
addViolationWithMessage(java.lang.Object data,
Node node,
java.lang.String message,
int beginLine,
int endLine) |
|
void |
addViolationWithMessage(java.lang.Object data,
Node node,
java.lang.String message,
java.lang.Object[] args) |
|
Rule |
deepCopy() |
Creates a new copy of this rule.
|
void |
deepCopyValuesTo(AbstractRule otherRule) |
Deprecated.
Use
deepCopy() to create verbatim copies of rules. |
void |
end(RuleContext ctx) |
End processing.
|
boolean |
equals(java.lang.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.
|
java.lang.String |
getDescription() |
Get the description of this Rule.
|
java.util.List<java.lang.String> |
getExamples() |
Get the list of examples for this Rule.
|
java.lang.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.
|
java.lang.String |
getMessage() |
Get the message to show when this Rule identifies a violation.
|
LanguageVersion |
getMinimumLanguageVersion() |
Get the minimum LanguageVersion to which this Rule applies.
|
java.lang.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.
|
java.util.List<java.lang.String> |
getRuleChainVisits() |
Gets the collection of AST node names visited by the Rule on the
RuleChain.
|
java.lang.String |
getRuleClass() |
Get the implementation class of this Rule.
|
java.lang.String |
getRuleSetName() |
Get the name of the RuleSet containing this Rule.
|
java.lang.String |
getSince() |
Get the version of PMD in which this Rule was added.
|
int |
hashCode() |
|
boolean |
isDeprecated() |
Gets whether this Rule is deprecated.
|
boolean |
isDfa() |
Gets whether this Rule uses Data Flow Analysis.
|
boolean |
isMultifile() |
Gets whether this Rule uses multi-file analysis.
|
boolean |
isRuleChain() |
Gets whether this Rule uses the RuleChain.
|
boolean |
isTypeResolution() |
Gets whether this Rule uses Type Resolution.
|
void |
setDeprecated(boolean deprecated) |
Sets whether this Rule is deprecated.
|
void |
setDescription(java.lang.String description) |
Set the description of this Rule.
|
void |
setDfa(boolean isDfa) |
Sets whether this Rule uses Data Flow Analysis.
|
void |
setExternalInfoUrl(java.lang.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(java.lang.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 |
setMultifile(boolean multifile) |
Sets whether this Rule uses multi-file analysis.
|
void |
setName(java.lang.String name) |
Set the name of this Rule.
|
void |
setPriority(RulePriority priority) |
Set the priority of this Rule.
|
void |
setRuleClass(java.lang.String ruleClass) |
Set the class of this Rule.
|
void |
setRuleSetName(java.lang.String ruleSetName) |
Set the name of the RuleSet containing this Rule.
|
void |
setSince(java.lang.String since) |
Set the version of PMD in which this Rule was added.
|
void |
setTypeResolution(boolean usingTypeResolution) |
Sets whether this Rule uses Type Resolution.
|
void |
setUsesDFA() |
Deprecated.
|
void |
setUsesMultifile() |
Deprecated.
|
void |
setUsesTypeResolution() |
Deprecated.
|
void |
start(RuleContext ctx) |
Start processing.
|
boolean |
usesDFA() |
Deprecated.
|
boolean |
usesMultifile() |
Deprecated.
|
boolean |
usesRuleChain() |
Deprecated.
|
boolean |
usesTypeResolution() |
Deprecated.
|
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
@Deprecated public void deepCopyValuesTo(AbstractRule otherRule)
deepCopy()
to create verbatim copies of rules.public Language getLanguage()
Rule
getLanguage
in interface Rule
public void setLanguage(Language language)
Rule
setLanguage
in interface Rule
language
- the languagepublic LanguageVersion getMinimumLanguageVersion()
Rule
null
it indicates there is no minimum bound.getMinimumLanguageVersion
in interface Rule
public void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
Rule
setMinimumLanguageVersion
in interface Rule
minimumLanguageVersion
- the minimum language versionpublic LanguageVersion getMaximumLanguageVersion()
Rule
null
it indicates there is no maximum bound.getMaximumLanguageVersion
in interface Rule
public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
Rule
setMaximumLanguageVersion
in interface Rule
maximumLanguageVersion
- the maximum language versionpublic boolean isDeprecated()
Rule
isDeprecated
in interface Rule
true
if this rule is deprecatedpublic void setDeprecated(boolean deprecated)
Rule
setDeprecated
in interface Rule
deprecated
- whether this rule is deprecatedpublic java.lang.String getName()
AbstractPropertySource
getName
in interface Rule
getName
in class AbstractPropertySource
public void setName(java.lang.String name)
Rule
public java.lang.String getSince()
Rule
null
if not applicable.public void setSince(java.lang.String since)
Rule
public java.lang.String getRuleClass()
Rule
getRuleClass
in interface Rule
public void setRuleClass(java.lang.String ruleClass)
Rule
setRuleClass
in interface Rule
ruleClass
- the class name of this rule.public java.lang.String getRuleSetName()
Rule
getRuleSetName
in interface Rule
RuleSet
public void setRuleSetName(java.lang.String ruleSetName)
Rule
setRuleSetName
in interface Rule
ruleSetName
- the name of the ruleset containing this rule.RuleSet
public java.lang.String getMessage()
Rule
getMessage
in interface Rule
public void setMessage(java.lang.String message)
Rule
setMessage
in interface Rule
message
- the message to show for a violation.public java.lang.String getDescription()
Rule
getDescription
in interface Rule
public void setDescription(java.lang.String description)
Rule
setDescription
in interface Rule
description
- the descriptionpublic java.util.List<java.lang.String> getExamples()
Rule
getExamples
in interface Rule
public void addExample(java.lang.String example)
Rule
addExample
in interface Rule
example
- a single example to addpublic java.lang.String getExternalInfoUrl()
Rule
getExternalInfoUrl
in interface Rule
public void setExternalInfoUrl(java.lang.String externalInfoUrl)
Rule
setExternalInfoUrl
in interface Rule
externalInfoUrl
- the URL for external information about this rule.public RulePriority getPriority()
Rule
getPriority
in interface Rule
public void setPriority(RulePriority priority)
Rule
setPriority
in interface Rule
priority
- the prioritypublic ParserOptions getParserOptions()
ParserOptions
using
default settings.getParserOptions
in interface Rule
Rule.setPriority(RulePriority)
@Deprecated public void setUsesDFA()
Rule
setUsesDFA
in interface Rule
public void setDfa(boolean isDfa)
Rule
@Deprecated public boolean usesDFA()
Rule
public boolean isDfa()
Rule
@Deprecated public void setUsesTypeResolution()
Rule
setUsesTypeResolution
in interface Rule
public void setTypeResolution(boolean usingTypeResolution)
Rule
setTypeResolution
in interface Rule
@Deprecated public boolean usesTypeResolution()
Rule
usesTypeResolution
in interface Rule
true
if Type Resolution is used.public boolean isTypeResolution()
Rule
isTypeResolution
in interface Rule
true
if Type Resolution is used.@Deprecated public void setUsesMultifile()
Rule
setUsesMultifile
in interface Rule
public void setMultifile(boolean multifile)
Rule
setMultifile
in interface Rule
@Deprecated public boolean usesMultifile()
Rule
usesMultifile
in interface Rule
true
if the multi file analysis is used.public boolean isMultifile()
Rule
isMultifile
in interface Rule
true
if the multi file analysis is used.@Deprecated public boolean usesRuleChain()
Rule
usesRuleChain
in interface Rule
true
if RuleChain is used.public boolean isRuleChain()
Rule
isRuleChain
in interface Rule
true
if RuleChain is used.public java.util.List<java.lang.String> getRuleChainVisits()
Rule
getRuleChainVisits
in interface Rule
public void addRuleChainVisit(java.lang.Class<? extends Node> nodeClass)
Rule
addRuleChainVisit
in interface Rule
nodeClass
- the AST node to add to the RuleChain visit listpublic void addRuleChainVisit(java.lang.String astNodeName)
Rule
addRuleChainVisit
in interface Rule
astNodeName
- the AST node to add to the RuleChain visit list as stringpublic void start(RuleContext ctx)
Rule
public void end(RuleContext ctx)
Rule
public void addViolation(java.lang.Object data, Node node)
public void addViolation(java.lang.Object data, Node node, java.lang.String arg)
public void addViolation(java.lang.Object data, Node node, java.lang.Object[] args)
public void addViolationWithMessage(java.lang.Object data, Node node, java.lang.String message)
public void addViolationWithMessage(java.lang.Object data, Node node, java.lang.String message, int beginLine, int endLine)
public void addViolationWithMessage(java.lang.Object data, Node node, java.lang.String message, java.lang.Object[] args)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2002–2018 PMD. All rights reserved.