PropertySource
, Rule
RuleReference
public abstract class AbstractDelegateRule extends java.lang.Object implements Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
Constructor | Description |
---|---|
AbstractDelegateRule() |
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 |
apply(java.util.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.
|
java.lang.String |
dysfunctionReason() |
Returns a description of why the receiver may be dysfunctional.
|
void |
end(RuleContext ctx) |
End processing.
|
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() |
Get the name of this Rule.
|
ParserOptions |
getParserOptions() |
Get the parser options for this Rule.
|
RulePriority |
getPriority() |
Get the priority of this Rule.
|
java.util.Map<PropertyDescriptor<?>,java.lang.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(java.lang.String name) |
Get the PropertyDescriptor for the given property name.
|
java.util.List<PropertyDescriptor<?>> |
getPropertyDescriptors() |
Get the PropertyDescriptors for all defined properties.
|
Rule |
getRule() |
|
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.
|
boolean |
hasDescriptor(PropertyDescriptor<?> descriptor) |
Returns whether this Rule has the specified PropertyDescriptor.
|
java.util.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.
|
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 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(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.
|
<V> void |
setProperty(MultiValuePropertyDescriptor<V> propertyDescriptor,
V... values) |
Sets the value of a multi value property descriptor with a variable number of arguments.
|
<T> void |
setProperty(PropertyDescriptor<T> propertyDescriptor,
T value) |
Set the property value specified (will be type-checked)
|
void |
setRule(Rule rule) |
|
void |
setRuleClass(java.lang.String ruleClass) |
Set the class of this Rule.
|
void |
setRuleSetName(java.lang.String name) |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
useDefaultValueFor, usesDefaultValues
public Rule getRule()
public void setRule(Rule rule)
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 dysfunctionReason()
PropertySource
dysfunctionReason
in interface PropertySource
PropertySource.dysfunctionReason()
public java.util.Set<PropertyDescriptor<?>> ignoredProperties()
PropertySource
ignoredProperties
in interface PropertySource
public java.lang.String getName()
Rule
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 name)
Rule
setRuleSetName
in interface Rule
name
- 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 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 java.lang.IllegalArgumentException
PropertySource
definePropertyDescriptor
in interface PropertySource
propertyDescriptor
- The property descriptor.java.lang.IllegalArgumentException
- If there is already a property defined the same name.public PropertyDescriptor<?> getPropertyDescriptor(java.lang.String name)
PropertySource
getPropertyDescriptor
in interface PropertySource
name
- The name of the property.null
if there is no such property defined.public java.util.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 <V> void setProperty(MultiValuePropertyDescriptor<V> propertyDescriptor, V... values)
PropertySource
setProperty
in interface PropertySource
V
- The type of the valuespropertyDescriptor
- The property descriptor for which to add a valuevalues
- Valuespublic java.util.Map<PropertyDescriptor<?>,java.lang.Object> getPropertiesByPropertyDescriptor()
PropertySource
getPropertiesByPropertyDescriptor
in interface PropertySource
@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 apply(java.util.List<? extends Node> nodes, RuleContext ctx)
Rule
public void end(RuleContext ctx)
Rule
public 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)
Copyright © 2002–2018 PMD. All rights reserved.