|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.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 Rulepublic void setLanguage(Language language)
Rule
setLanguage in interface Rulelanguage - the languagepublic LanguageVersion getMinimumLanguageVersion()
Rulenull it indicates there is no minimum bound.
getMinimumLanguageVersion in interface Rulepublic void setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)
Rule
setMinimumLanguageVersion in interface RuleminimumlanguageVersion - the minimum language versionpublic void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)
Rule
setMaximumLanguageVersion in interface RulemaximumlanguageVersion - the maximum language versionpublic LanguageVersion getMaximumLanguageVersion()
Rulenull it indicates there is no maximum bound.
getMaximumLanguageVersion in interface Rulepublic boolean isDeprecated()
Rule
isDeprecated in interface Ruletrue if this rule is deprecatedpublic String dysfunctionReason()
PropertySource
dysfunctionReason in interface PropertySourcePropertySource.dysfunctionReason()public Set<PropertyDescriptor<?>> ignoredProperties()
PropertySource
ignoredProperties in interface PropertySourcepublic void setDeprecated(boolean deprecated)
Rule
setDeprecated in interface Ruledeprecated - whether this rule is deprecatedpublic String getName()
Rule
getName in interface Rulepublic void setName(String name)
Rule
setName in interface Rulename - the namepublic String getSince()
Rulenull if not applicable.
getSince in interface Rulepublic void setSince(String since)
Rule
setSince in interface Rulesince - the version of PMD since when this rule was addedpublic String getRuleClass()
Rule
getRuleClass in interface Rulepublic void setRuleClass(String ruleClass)
Rule
setRuleClass in interface RuleruleClass - the class name of this rule.public String getRuleSetName()
Rule
getRuleSetName in interface RuleRuleSetpublic void setRuleSetName(String name)
Rule
setRuleSetName in interface Rulename - the name of the ruleset containing this rule.RuleSetpublic String getMessage()
Rule
getMessage in interface Rulepublic void setMessage(String message)
Rule
setMessage in interface Rulemessage - the message to show for a violation.public String getDescription()
Rule
getDescription in interface Rulepublic void setDescription(String description)
Rule
setDescription in interface Ruledescription - the descriptionpublic List<String> getExamples()
Rule
getExamples in interface Rulepublic void addExample(String example)
Rule
addExample in interface Ruleexample - a single example to addpublic String getExternalInfoUrl()
Rule
getExternalInfoUrl in interface Rulepublic void setExternalInfoUrl(String url)
Rule
setExternalInfoUrl in interface Ruleurl - the URL for external information about this rule.public RulePriority getPriority()
Rule
getPriority in interface Rulepublic void setPriority(RulePriority priority)
Rule
setPriority in interface Rulepriority - the prioritypublic ParserOptions getParserOptions()
RuleParser 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 PropertySourcepropertyDescriptor - The property descriptor.
IllegalArgumentException - If there is already a property defined
the same name.public PropertyDescriptor<?> getPropertyDescriptor(String name)
PropertySource
getPropertyDescriptor in interface PropertySourcename - The name of the property.
null
if there is no such property defined.public List<PropertyDescriptor<?>> getPropertyDescriptors()
PropertySource
getPropertyDescriptors in interface PropertySourcepublic <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
PropertySource
getProperty in interface PropertySourceT - The underlying type of the property descriptor.propertyDescriptor - The property descriptor.
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor,
T value)
PropertySource
setProperty in interface PropertySourceT - 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 PropertySourcepublic void setUsesDFA()
Rule
setUsesDFA in interface Rulepublic boolean usesDFA()
Rule
usesDFA in interface Ruletrue if Data Flow Analysis is used.public void setUsesTypeResolution()
Rule
setUsesTypeResolution in interface Rulepublic boolean usesTypeResolution()
Rule
usesTypeResolution in interface Ruletrue if Type Resolution is used.public boolean usesRuleChain()
Rule
usesRuleChain in interface Ruletrue if RuleChain is used.public List<String> getRuleChainVisits()
Rule
getRuleChainVisits in interface Rulepublic void addRuleChainVisit(Class<? extends Node> nodeClass)
Rule
addRuleChainVisit in interface RulenodeClass - the AST node to add to the RuleChain visit listpublic void addRuleChainVisit(String astNodeName)
Rule
addRuleChainVisit in interface RuleastNodeName - the AST node to add to the RuleChain visit list as
stringpublic void start(RuleContext ctx)
Rule
start in interface Rulectx - the rule context
public void apply(List<? extends Node> nodes,
RuleContext ctx)
Rule
apply in interface Rulenodes - the nodesctx - the rule contextpublic void end(RuleContext ctx)
Rule
end in interface Rulectx - the rule contextpublic boolean hasDescriptor(PropertyDescriptor<?> descriptor)
PropertySource
hasDescriptor in interface PropertySourcedescriptor - 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 | |||||||||