|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pmd.lang.rule.AbstractDelegateRule
public abstract class AbstractDelegateRule
Base class for Rule implementations which delegate to another Rule instance.
Field Summary |
---|
Fields inherited from interface net.sourceforge.pmd.Rule |
---|
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR |
Constructor Summary | |
---|---|
AbstractDelegateRule()
|
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 |
apply(List<? extends Node> nodes,
RuleContext ctx)
Apply this rule to the given collection of nodes, using the given context. |
|
void |
definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
Define a new property via a PropertyDescriptor. |
|
String |
dysfunctionReason()
Returns a description of why the receiver may be dysfunctional. |
|
void |
end(RuleContext ctx)
End processing. |
|
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()
Get the parser options for this Rule. |
|
RulePriority |
getPriority()
Get the priority of this Rule. |
|
Map<PropertyDescriptor<?>,Object> |
getPropertiesByPropertyDescriptor()
Returns all the current property values for the receiver or an immutable empty map if none are specified. |
|
|
getProperty(PropertyDescriptor<T> propertyDescriptor)
Get the typed value for the given property. |
|
PropertyDescriptor<?> |
getPropertyDescriptor(String name)
Get the PropertyDescriptor for the given property name. |
|
List<PropertyDescriptor<?>> |
getPropertyDescriptors()
Get the PropertyDescriptors for all defined properties. |
|
Rule |
getRule()
|
|
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. |
|
boolean |
hasDescriptor(PropertyDescriptor<?> descriptor)
Returns whether this Rule has the specified PropertyDescriptor. |
|
Set<PropertyDescriptor<?>> |
ignoredProperties()
Return the properties that are effectively ignored due to the configuration of the rule and values held by other properties. |
|
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 url)
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. |
|
|
setProperty(PropertyDescriptor<T> propertyDescriptor,
T value)
Set the property value specified (will be type-checked) |
|
void |
setRule(Rule rule)
|
|
void |
setRuleClass(String ruleClass)
Set the class of this Rule. |
|
void |
setRuleSetName(String name)
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.pmd.PropertySource |
---|
useDefaultValueFor, usesDefaultValues |
Constructor Detail |
---|
public AbstractDelegateRule()
Method Detail |
---|
public void setRule(Rule rule)
public Rule getRule()
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 void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)
Rule
setMaximumLanguageVersion
in interface Rule
maximumlanguageVersion
- the maximum language versionpublic LanguageVersion getMaximumLanguageVersion()
Rule
null
it indicates there is no maximum bound.
getMaximumLanguageVersion
in interface Rule
public boolean isDeprecated()
Rule
isDeprecated
in interface Rule
true
if this rule is deprecatedpublic String dysfunctionReason()
PropertySource
dysfunctionReason
in interface PropertySource
PropertySource.dysfunctionReason()
public Set<PropertyDescriptor<?>> ignoredProperties()
PropertySource
ignoredProperties
in interface PropertySource
public void setDeprecated(boolean deprecated)
Rule
setDeprecated
in interface Rule
deprecated
- whether this rule is deprecatedpublic String getName()
Rule
getName
in interface Rule
public void setName(String name)
Rule
setName
in interface Rule
name
- the namepublic String getSince()
Rule
null
if not applicable.
getSince
in interface Rule
public void setSince(String since)
Rule
setSince
in interface Rule
since
- the version of PMD since when this rule was addedpublic String getRuleClass()
Rule
getRuleClass
in interface Rule
public void setRuleClass(String ruleClass)
Rule
setRuleClass
in interface Rule
ruleClass
- the class name of this rule.public String getRuleSetName()
Rule
getRuleSetName
in interface Rule
RuleSet
public void setRuleSetName(String name)
Rule
setRuleSetName
in interface Rule
name
- the name of the ruleset containing this rule.RuleSet
public String getMessage()
Rule
getMessage
in interface Rule
public void setMessage(String message)
Rule
setMessage
in interface Rule
message
- the message to show for a violation.public String getDescription()
Rule
getDescription
in interface Rule
public void setDescription(String description)
Rule
setDescription
in interface Rule
description
- the descriptionpublic List<String> getExamples()
Rule
getExamples
in interface Rule
public void addExample(String example)
Rule
addExample
in interface Rule
example
- a single example to addpublic String getExternalInfoUrl()
Rule
getExternalInfoUrl
in interface Rule
public void setExternalInfoUrl(String url)
Rule
setExternalInfoUrl
in interface Rule
url
- 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()
Rule
Parser
to create an AST in the form the Rule is
expecting. Because ParserOptions are mutable, a Rule should return a new
instance on each call.
getParserOptions
in interface Rule
public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor) throws IllegalArgumentException
PropertySource
definePropertyDescriptor
in interface PropertySource
propertyDescriptor
- The property descriptor.
IllegalArgumentException
- If there is already a property defined
the same name.public PropertyDescriptor<?> getPropertyDescriptor(String name)
PropertySource
getPropertyDescriptor
in interface PropertySource
name
- The name of the property.
null
if there is no such property defined.public List<PropertyDescriptor<?>> getPropertyDescriptors()
PropertySource
getPropertyDescriptors
in interface PropertySource
public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
PropertySource
getProperty
in interface PropertySource
T
- The underlying type of the property descriptor.propertyDescriptor
- The property descriptor.
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value)
PropertySource
setProperty
in interface PropertySource
T
- The underlying type of the property descriptor.propertyDescriptor
- The property descriptor.value
- The value to set.public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
PropertySource
getPropertiesByPropertyDescriptor
in interface PropertySource
public void setUsesDFA()
Rule
setUsesDFA
in interface Rule
public boolean usesDFA()
Rule
usesDFA
in interface Rule
true
if Data Flow Analysis is used.public void setUsesTypeResolution()
Rule
setUsesTypeResolution
in interface Rule
public boolean usesTypeResolution()
Rule
usesTypeResolution
in interface Rule
true
if Type Resolution is used.public boolean usesRuleChain()
Rule
usesRuleChain
in interface Rule
true
if RuleChain is used.public List<String> getRuleChainVisits()
Rule
getRuleChainVisits
in interface Rule
public void addRuleChainVisit(Class<? extends Node> nodeClass)
Rule
addRuleChainVisit
in interface Rule
nodeClass
- the AST node to add to the RuleChain visit listpublic void addRuleChainVisit(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
start
in interface Rule
ctx
- the rule contextpublic void apply(List<? extends Node> nodes, RuleContext ctx)
Rule
apply
in interface Rule
nodes
- the nodesctx
- the rule contextpublic void end(RuleContext ctx)
Rule
end
in interface Rule
ctx
- the rule contextpublic boolean hasDescriptor(PropertyDescriptor<?> descriptor)
PropertySource
hasDescriptor
in interface PropertySource
descriptor
- The PropertyDescriptor for which to check.
true
if the descriptor is present,
false
otherwise.PropertySource.hasDescriptor(PropertyDescriptor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |