Package net.sourceforge.pmd.lang.rule
Class AbstractDelegateRule
- java.lang.Object
-
- net.sourceforge.pmd.lang.rule.AbstractDelegateRule
-
- All Implemented Interfaces:
PropertySource
,Rule
- Direct Known Subclasses:
RuleReference
@Deprecated public abstract class AbstractDelegateRule extends Object implements Rule
Deprecated.This is only relevant toRuleReference
, but prevents sharing the implementation ofAbstractPropertySource
. Will be removed in 7.0.0Base 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
Constructors Constructor Description AbstractDelegateRule()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addExample(String example)
Deprecated.Add a single example for this Rule.void
apply(Node target, RuleContext ctx)
Deprecated.Process the given node.void
definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
Deprecated.Defines a new property.String
dysfunctionReason()
Deprecated.Returns a description of why the receiver may be dysfunctional.void
end(RuleContext ctx)
Deprecated.End processing.String
getDescription()
Deprecated.Get the description of this Rule.List<String>
getExamples()
Deprecated.Get the list of examples for this Rule.String
getExternalInfoUrl()
Deprecated.Get a URL for external information about this Rule.Language
getLanguage()
Deprecated.Get the Language of this Rule.LanguageVersion
getMaximumLanguageVersion()
Deprecated.Get the maximum LanguageVersion to which this Rule applies.String
getMessage()
Deprecated.Get the message to show when this Rule identifies a violation.LanguageVersion
getMinimumLanguageVersion()
Deprecated.Get the minimum LanguageVersion to which this Rule applies.String
getName()
Deprecated.Get the name of this Rule.RulePriority
getPriority()
Deprecated.Get the priority of this Rule.Map<PropertyDescriptor<?>,Object>
getPropertiesByPropertyDescriptor()
Deprecated.Returns an unmodifiable map of descriptors to property values for the current receiver.<T> T
getProperty(PropertyDescriptor<T> propertyDescriptor)
Deprecated.Get the typed value for the given property.PropertyDescriptor<?>
getPropertyDescriptor(String name)
Deprecated.Get the PropertyDescriptor for the given property name.List<PropertyDescriptor<?>>
getPropertyDescriptors()
Deprecated.Get the descriptors of all defined properties.Rule
getRule()
Deprecated.String
getRuleClass()
Deprecated.Get the implementation class of this Rule.String
getRuleSetName()
Deprecated.Get the name of the RuleSet containing this Rule.String
getSince()
Deprecated.Get the version of PMD in which this Rule was added.RuleTargetSelector
getTargetSelector()
Deprecated.Returns the object that selects the nodes to which this rule applies.boolean
hasDescriptor(PropertyDescriptor<?> descriptor)
Deprecated.Returns whether the specified property is defined on this property source, in which case it can be set or retrieved withPropertySource.getProperty(PropertyDescriptor)
andPropertySource.setProperty(PropertyDescriptor, Object)
.void
initialize(LanguageProcessor languageProcessor)
Deprecated.Initialize the rule using the language processor if needed.boolean
isDeprecated()
Deprecated.Gets whether this Rule is deprecated.boolean
isPropertyOverridden(PropertyDescriptor<?> propertyDescriptor)
Deprecated.Returns true if the given property has been set to a value somewhere in the XML.void
setDeprecated(boolean deprecated)
Deprecated.Sets whether this Rule is deprecated.void
setDescription(String description)
Deprecated.Set the description of this Rule.void
setExternalInfoUrl(String url)
Deprecated.Set a URL for external information about this Rule.void
setLanguage(Language language)
Deprecated.Set the Language of this Rule.void
setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)
Deprecated.Set the maximum LanguageVersion to which this Rule applies.void
setMessage(String message)
Deprecated.Set the message to show when this Rule identifies a violation.void
setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)
Deprecated.Set the minimum LanguageVersion to which this Rule applies.void
setName(String name)
Deprecated.Set the name of this Rule.void
setPriority(RulePriority priority)
Deprecated.Set the priority of this Rule.<V> void
setProperty(MultiValuePropertyDescriptor<V> propertyDescriptor, V... values)
Deprecated.Sets the value of a multi value property descriptor with a variable number of arguments.<T> void
setProperty(PropertyDescriptor<T> propertyDescriptor, T value)
Deprecated.Set the property value specified.void
setRule(Rule rule)
Deprecated.This will be removed in 7.0.0 I mark it specially deprecated because it's inherited by rule reference, even though a RuleReference has no business setting its rule after constructionvoid
setRuleClass(String ruleClass)
Deprecated.Set the class of this Rule.void
setRuleSetName(String name)
Deprecated.Set the name of the RuleSet containing this Rule.void
setSince(String since)
Deprecated.Set the version of PMD in which this Rule was added.void
start(RuleContext ctx)
Deprecated.Start processing.-
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.properties.PropertySource
getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors
-
-
-
-
Method Detail
-
getRule
public Rule getRule()
Deprecated.
-
setRule
@Deprecated public void setRule(Rule rule)
Deprecated.This will be removed in 7.0.0 I mark it specially deprecated because it's inherited by rule reference, even though a RuleReference has no business setting its rule after construction
-
getLanguage
public Language getLanguage()
Deprecated.Description copied from interface:Rule
Get the Language of this Rule.- Specified by:
getLanguage
in interfaceRule
- Returns:
- the language
-
setLanguage
public void setLanguage(Language language)
Deprecated.Description copied from interface:Rule
Set the Language of this Rule.- Specified by:
setLanguage
in interfaceRule
- Parameters:
language
- the language
-
getMinimumLanguageVersion
public LanguageVersion getMinimumLanguageVersion()
Deprecated.Description copied from interface:Rule
Get the minimum LanguageVersion to which this Rule applies. If this value isnull
it indicates there is no minimum bound.- Specified by:
getMinimumLanguageVersion
in interfaceRule
- Returns:
- the minimum language version
-
setMinimumLanguageVersion
public void setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)
Deprecated.Description copied from interface:Rule
Set the minimum LanguageVersion to which this Rule applies.- Specified by:
setMinimumLanguageVersion
in interfaceRule
- Parameters:
minimumlanguageVersion
- the minimum language version
-
getMaximumLanguageVersion
public LanguageVersion getMaximumLanguageVersion()
Deprecated.Description copied from interface:Rule
Get the maximum LanguageVersion to which this Rule applies. If this value isnull
it indicates there is no maximum bound.- Specified by:
getMaximumLanguageVersion
in interfaceRule
- Returns:
- the maximum language version
-
setMaximumLanguageVersion
public void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)
Deprecated.Description copied from interface:Rule
Set the maximum LanguageVersion to which this Rule applies.- Specified by:
setMaximumLanguageVersion
in interfaceRule
- Parameters:
maximumlanguageVersion
- the maximum language version
-
isDeprecated
public boolean isDeprecated()
Deprecated.Description copied from interface:Rule
Gets whether this Rule is deprecated. A deprecated Rule is one which:- is scheduled for removal in a future version of PMD
- or, has been removed and replaced with a non-functioning place-holder and will be completely removed in a future version of PMD
- or, has been renamed/moved and the old name will be completely removed in a future version of PMD
- Specified by:
isDeprecated
in interfaceRule
- Returns:
true
if this rule is deprecated
-
setDeprecated
public void setDeprecated(boolean deprecated)
Deprecated.Description copied from interface:Rule
Sets whether this Rule is deprecated.- Specified by:
setDeprecated
in interfaceRule
- Parameters:
deprecated
- whether this rule is deprecated
-
dysfunctionReason
public String dysfunctionReason()
Deprecated.Description copied from interface:PropertySource
Returns a description of why the receiver may be dysfunctional. Usually due to missing property values or some kind of conflict between values. Returns null if the receiver is ok.- Specified by:
dysfunctionReason
in interfacePropertySource
- Returns:
- String
- See Also:
PropertySource.dysfunctionReason()
-
getName
public String getName()
Deprecated.Description copied from interface:Rule
Get the name of this Rule.- Specified by:
getName
in interfacePropertySource
- Specified by:
getName
in interfaceRule
- Returns:
- the name
-
setName
public void setName(String name)
Deprecated.Description copied from interface:Rule
Set the name of this Rule.
-
getSince
public String getSince()
Deprecated.Description copied from interface:Rule
Get the version of PMD in which this Rule was added. Returnnull
if not applicable.
-
setSince
public void setSince(String since)
Deprecated.Description copied from interface:Rule
Set the version of PMD in which this Rule was added.
-
getRuleClass
public String getRuleClass()
Deprecated.Description copied from interface:Rule
Get the implementation class of this Rule.- Specified by:
getRuleClass
in interfaceRule
- Returns:
- the implementation class name of this rule.
-
setRuleClass
public void setRuleClass(String ruleClass)
Deprecated.Description copied from interface:Rule
Set the class of this Rule.- Specified by:
setRuleClass
in interfaceRule
- Parameters:
ruleClass
- the class name of this rule.
-
getRuleSetName
public String getRuleSetName()
Deprecated.Description copied from interface:Rule
Get the name of the RuleSet containing this Rule.- Specified by:
getRuleSetName
in interfaceRule
- Returns:
- the name of th ruleset containing this rule.
- See Also:
RuleSet
-
setRuleSetName
public void setRuleSetName(String name)
Deprecated.Description copied from interface:Rule
Set the name of the RuleSet containing this Rule.- Specified by:
setRuleSetName
in interfaceRule
- Parameters:
name
- the name of the ruleset containing this rule.- See Also:
RuleSet
-
getMessage
public String getMessage()
Deprecated.Description copied from interface:Rule
Get the message to show when this Rule identifies a violation.- Specified by:
getMessage
in interfaceRule
- Returns:
- the message to show for a violation.
-
setMessage
public void setMessage(String message)
Deprecated.Description copied from interface:Rule
Set the message to show when this Rule identifies a violation.- Specified by:
setMessage
in interfaceRule
- Parameters:
message
- the message to show for a violation.
-
getDescription
public String getDescription()
Deprecated.Description copied from interface:Rule
Get the description of this Rule.- Specified by:
getDescription
in interfaceRule
- Returns:
- the description
-
setDescription
public void setDescription(String description)
Deprecated.Description copied from interface:Rule
Set the description of this Rule.- Specified by:
setDescription
in interfaceRule
- Parameters:
description
- the description
-
getExamples
public List<String> getExamples()
Deprecated.Description copied from interface:Rule
Get the list of examples for this Rule.- Specified by:
getExamples
in interfaceRule
- Returns:
- the list of examples for this rule.
-
addExample
public void addExample(String example)
Deprecated.Description copied from interface:Rule
Add a single example for this Rule.- Specified by:
addExample
in interfaceRule
- Parameters:
example
- a single example to add
-
getExternalInfoUrl
public String getExternalInfoUrl()
Deprecated.Description copied from interface:Rule
Get a URL for external information about this Rule.- Specified by:
getExternalInfoUrl
in interfaceRule
- Returns:
- the URL for external information about this rule.
-
setExternalInfoUrl
public void setExternalInfoUrl(String url)
Deprecated.Description copied from interface:Rule
Set a URL for external information about this Rule.- Specified by:
setExternalInfoUrl
in interfaceRule
- Parameters:
url
- the URL for external information about this rule.
-
getPriority
public RulePriority getPriority()
Deprecated.Description copied from interface:Rule
Get the priority of this Rule.- Specified by:
getPriority
in interfaceRule
- Returns:
- the priority
-
setPriority
public void setPriority(RulePriority priority)
Deprecated.Description copied from interface:Rule
Set the priority of this Rule.- Specified by:
setPriority
in interfaceRule
- Parameters:
priority
- the priority
-
definePropertyDescriptor
public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor) throws IllegalArgumentException
Deprecated.Description copied from interface:PropertySource
Defines a new property. Properties must be defined before they can be set a value.- Specified by:
definePropertyDescriptor
in interfacePropertySource
- Parameters:
propertyDescriptor
- The property descriptor.- Throws:
IllegalArgumentException
- If there is already a property defined the same name.
-
getPropertyDescriptor
public PropertyDescriptor<?> getPropertyDescriptor(String name)
Deprecated.Description copied from interface:PropertySource
Get the PropertyDescriptor for the given property name.- Specified by:
getPropertyDescriptor
in interfacePropertySource
- Parameters:
name
- The name of the property.- Returns:
- The PropertyDescriptor for the named property,
null
if there is no such property defined.
-
getPropertyDescriptors
public List<PropertyDescriptor<?>> getPropertyDescriptors()
Deprecated.Description copied from interface:PropertySource
Get the descriptors of all defined properties. The properties are returned sorted by UI order.- Specified by:
getPropertyDescriptors
in interfacePropertySource
- Returns:
- The PropertyDescriptors in UI order.
-
getProperty
public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
Deprecated.Description copied from interface:PropertySource
Get the typed value for the given property. Multi valued properties return immutable lists.- Specified by:
getProperty
in interfacePropertySource
- Type Parameters:
T
- The underlying type of the property descriptor.- Parameters:
propertyDescriptor
- The property descriptor.- Returns:
- The property value.
-
setProperty
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value)
Deprecated.Description copied from interface:PropertySource
Set the property value specified. This is also referred to as "overriding" the (default) value of a property.- Specified by:
setProperty
in interfacePropertySource
- Type Parameters:
T
- The underlying type of the property descriptor.- Parameters:
propertyDescriptor
- The property descriptor.value
- The value to set.
-
setProperty
public <V> void setProperty(MultiValuePropertyDescriptor<V> propertyDescriptor, V... values)
Deprecated.Description copied from interface:PropertySource
Sets the value of a multi value property descriptor with a variable number of arguments. This is also referred to as "overriding" the (default) value of a property.- Specified by:
setProperty
in interfacePropertySource
- Type Parameters:
V
- The type of the values- Parameters:
propertyDescriptor
- The property descriptor for which to add a valuevalues
- Values
-
isPropertyOverridden
public boolean isPropertyOverridden(PropertyDescriptor<?> propertyDescriptor)
Deprecated.Description copied from interface:PropertySource
Returns true if the given property has been set to a value somewhere in the XML.- Specified by:
isPropertyOverridden
in interfacePropertySource
- Parameters:
propertyDescriptor
- The descriptor- Returns:
- True if the property has been set
-
getPropertiesByPropertyDescriptor
public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
Deprecated.Description copied from interface:PropertySource
Returns an unmodifiable map of descriptors to property values for the current receiver. The returned map has an entry for every defined descriptor (PropertySource.getPropertyDescriptors()
), if they were not specified explicitly, then default values are used.- Specified by:
getPropertiesByPropertyDescriptor
in interfacePropertySource
- Returns:
- An unmodifiable map of descriptors to property values
-
getTargetSelector
public RuleTargetSelector getTargetSelector()
Deprecated.Description copied from interface:Rule
Returns the object that selects the nodes to which this rule applies. The selected nodes will be handed toRule.apply(Node, RuleContext)
.- Specified by:
getTargetSelector
in interfaceRule
-
start
public void start(RuleContext ctx)
Deprecated.Description copied from interface:Rule
Start processing. Called once per file, before apply() is first called.
-
apply
public void apply(Node target, RuleContext ctx)
Deprecated.Description copied from interface:Rule
Process the given node. The nodes that are fed to this method are the nodes selected byRule.getTargetSelector()
.
-
end
public void end(RuleContext ctx)
Deprecated.Description copied from interface:Rule
End processing. Called once per file, after apply() is last called.
-
initialize
public void initialize(LanguageProcessor languageProcessor)
Deprecated.Description copied from interface:Rule
Initialize the rule using the language processor if needed.- Specified by:
initialize
in interfaceRule
- Parameters:
languageProcessor
- The processor for the rule's language
-
hasDescriptor
public boolean hasDescriptor(PropertyDescriptor<?> descriptor)
Deprecated.Description copied from interface:PropertySource
Returns whether the specified property is defined on this property source, in which case it can be set or retrieved withPropertySource.getProperty(PropertyDescriptor)
andPropertySource.setProperty(PropertyDescriptor, Object)
.- Specified by:
hasDescriptor
in interfacePropertySource
- Parameters:
descriptor
- The descriptor to look for- Returns:
true
if the descriptor is defined,false
otherwise.- See Also:
PropertySource.hasDescriptor(PropertyDescriptor)
-
-