public abstract class AbstractDelegateRule extends Object implements Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR| Constructor and Description |
|---|
AbstractDelegateRule() |
| 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 |
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.
|
<T> T |
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.
|
<T> void |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waituseDefaultValueFor, usesDefaultValuespublic void setRule(Rule rule)
public Rule getRule()
public Language getLanguage()
RulegetLanguage in interface Rulepublic void setLanguage(Language language)
RulesetLanguage in interface Rulelanguage - the languagepublic LanguageVersion getMinimumLanguageVersion()
Rulenull it indicates there is no minimum bound.getMinimumLanguageVersion in interface Rulepublic void setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)
RulesetMinimumLanguageVersion in interface RuleminimumlanguageVersion - the minimum language versionpublic void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)
RulesetMaximumLanguageVersion in interface RulemaximumlanguageVersion - the maximum language versionpublic LanguageVersion getMaximumLanguageVersion()
Rulenull it indicates there is no maximum bound.getMaximumLanguageVersion in interface Rulepublic boolean isDeprecated()
RuleisDeprecated in interface Ruletrue if this rule is deprecatedpublic String dysfunctionReason()
PropertySourcedysfunctionReason in interface PropertySourcePropertySource.dysfunctionReason()public Set<PropertyDescriptor<?>> ignoredProperties()
PropertySourceignoredProperties in interface PropertySourcepublic void setDeprecated(boolean deprecated)
RulesetDeprecated in interface Ruledeprecated - whether this rule is deprecatedpublic void setName(String name)
Rulepublic String getSince()
Rulenull if not applicable.public void setSince(String since)
Rulepublic String getRuleClass()
RulegetRuleClass in interface Rulepublic void setRuleClass(String ruleClass)
RulesetRuleClass in interface RuleruleClass - the class name of this rule.public String getRuleSetName()
RulegetRuleSetName in interface RuleRuleSetpublic void setRuleSetName(String name)
RulesetRuleSetName in interface Rulename - the name of the ruleset containing this rule.RuleSetpublic String getMessage()
RulegetMessage in interface Rulepublic void setMessage(String message)
RulesetMessage in interface Rulemessage - the message to show for a violation.public String getDescription()
RulegetDescription in interface Rulepublic void setDescription(String description)
RulesetDescription in interface Ruledescription - the descriptionpublic List<String> getExamples()
RulegetExamples in interface Rulepublic void addExample(String example)
RuleaddExample in interface Ruleexample - a single example to addpublic String getExternalInfoUrl()
RulegetExternalInfoUrl in interface Rulepublic void setExternalInfoUrl(String url)
RulesetExternalInfoUrl in interface Ruleurl - the URL for external information about this rule.public RulePriority getPriority()
RulegetPriority in interface Rulepublic void setPriority(RulePriority priority)
RulesetPriority 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 Rulepublic void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor) throws IllegalArgumentException
PropertySourcedefinePropertyDescriptor in interface PropertySourcepropertyDescriptor - The property descriptor.IllegalArgumentException - If there is already a property defined
the same name.public PropertyDescriptor<?> getPropertyDescriptor(String name)
PropertySourcegetPropertyDescriptor in interface PropertySourcename - The name of the property.null
if there is no such property defined.public List<PropertyDescriptor<?>> getPropertyDescriptors()
PropertySourcegetPropertyDescriptors in interface PropertySourcepublic <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
PropertySourcegetProperty in interface PropertySourceT - The underlying type of the property descriptor.propertyDescriptor - The property descriptor.public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value)
PropertySourcesetProperty in interface PropertySourceT - The underlying type of the property descriptor.propertyDescriptor - The property descriptor.value - The value to set.public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
PropertySourcegetPropertiesByPropertyDescriptor in interface PropertySourcepublic void setUsesDFA()
RulesetUsesDFA in interface Rulepublic boolean usesDFA()
Rulepublic void setUsesTypeResolution()
RulesetUsesTypeResolution in interface Rulepublic boolean usesTypeResolution()
RuleusesTypeResolution in interface Ruletrue if Type Resolution is used.public boolean usesRuleChain()
RuleusesRuleChain in interface Ruletrue if RuleChain is used.public List<String> getRuleChainVisits()
RulegetRuleChainVisits in interface Rulepublic void addRuleChainVisit(Class<? extends Node> nodeClass)
RuleaddRuleChainVisit in interface RulenodeClass - the AST node to add to the RuleChain visit listpublic void addRuleChainVisit(String astNodeName)
RuleaddRuleChainVisit in interface RuleastNodeName - the AST node to add to the RuleChain visit list as
stringpublic void start(RuleContext ctx)
Rulepublic void apply(List<? extends Node> nodes, RuleContext ctx)
Rulepublic void end(RuleContext ctx)
Rulepublic boolean hasDescriptor(PropertyDescriptor<?> descriptor)
PropertySourcehasDescriptor in interface PropertySourcedescriptor - The PropertyDescriptor for which to check.true if the descriptor is present,
false otherwise.PropertySource.hasDescriptor(PropertyDescriptor)Copyright © 2002-2014 InfoEther. All Rights Reserved.