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 voidaddExample(String example)Deprecated.Add a single example for this Rule.voidaddRuleChainVisit(Class<? extends Node> nodeClass)Deprecated.Adds an AST node by class to be visited by the Rule on the RuleChain.voidaddRuleChainVisit(String astNodeName)Deprecated.Adds an AST node by name to be visited by the Rule on the RuleChain.voidapply(List<? extends Node> nodes, RuleContext ctx)Deprecated.Apply this rule to the given collection of nodes, using the given context.voiddefinePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)Deprecated.Defines a new property.StringdysfunctionReason()Deprecated.Returns a description of why the receiver may be dysfunctional.voidend(RuleContext ctx)Deprecated.End processing.StringgetDescription()Deprecated.Get the description of this Rule.List<String>getExamples()Deprecated.Get the list of examples for this Rule.StringgetExternalInfoUrl()Deprecated.Get a URL for external information about this Rule.LanguagegetLanguage()Deprecated.Get the Language of this Rule.LanguageVersiongetMaximumLanguageVersion()Deprecated.Get the maximum LanguageVersion to which this Rule applies.StringgetMessage()Deprecated.Get the message to show when this Rule identifies a violation.LanguageVersiongetMinimumLanguageVersion()Deprecated.Get the minimum LanguageVersion to which this Rule applies.StringgetName()Deprecated.Get the name of this Rule.ParserOptionsgetParserOptions()Deprecated.Get the parser options for this Rule.RulePrioritygetPriority()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> TgetProperty(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.RulegetRule()Deprecated.List<String>getRuleChainVisits()Deprecated.Gets the collection of AST node names visited by the Rule on the RuleChain.StringgetRuleClass()Deprecated.Get the implementation class of this Rule.StringgetRuleSetName()Deprecated.Get the name of the RuleSet containing this Rule.StringgetSince()Deprecated.Get the version of PMD in which this Rule was added.booleanhasDescriptor(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).Set<PropertyDescriptor<?>>ignoredProperties()Deprecated.Return the properties that are effectively ignored due to the configuration of the rule and values held by other properties.booleanisDeprecated()Deprecated.Gets whether this Rule is deprecated.booleanisDfa()Deprecated.Gets whether this Rule uses Data Flow Analysis.booleanisMultifile()Deprecated.Gets whether this Rule uses multi-file analysis.booleanisPropertyOverridden(PropertyDescriptor<?> propertyDescriptor)Deprecated.Returns true if the given property has been set to a value somewhere in the XML.booleanisRuleChain()Deprecated.Gets whether this Rule uses the RuleChain.booleanisTypeResolution()Deprecated.Gets whether this Rule uses Type Resolution.voidsetDeprecated(boolean deprecated)Deprecated.Sets whether this Rule is deprecated.voidsetDescription(String description)Deprecated.Set the description of this Rule.voidsetDfa(boolean isDfa)Deprecated.Sets whether this Rule uses Data Flow Analysis.voidsetExternalInfoUrl(String url)Deprecated.Set a URL for external information about this Rule.voidsetLanguage(Language language)Deprecated.Set the Language of this Rule.voidsetMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)Deprecated.Set the maximum LanguageVersion to which this Rule applies.voidsetMessage(String message)Deprecated.Set the message to show when this Rule identifies a violation.voidsetMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)Deprecated.Set the minimum LanguageVersion to which this Rule applies.voidsetMultifile(boolean multifile)Deprecated.Sets whether this Rule uses multi-file analysis.voidsetName(String name)Deprecated.Set the name of this Rule.voidsetPriority(RulePriority priority)Deprecated.Set the priority of this Rule.<V> voidsetProperty(MultiValuePropertyDescriptor<V> propertyDescriptor, V... values)Deprecated.Sets the value of a multi value property descriptor with a variable number of arguments.<T> voidsetProperty(PropertyDescriptor<T> propertyDescriptor, T value)Deprecated.Set the property value specified.voidsetRule(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 constructionvoidsetRuleClass(String ruleClass)Deprecated.Set the class of this Rule.voidsetRuleSetName(String name)Deprecated.Set the name of the RuleSet containing this Rule.voidsetSince(String since)Deprecated.Set the version of PMD in which this Rule was added.voidsetTypeResolution(boolean usingTypeResolution)Deprecated.Sets whether this Rule uses Type Resolution.voidsetUsesDFA()Deprecated.voidsetUsesMultifile()Deprecated.voidsetUsesTypeResolution()Deprecated.voidstart(RuleContext ctx)Deprecated.Start processing.booleanusesDFA()Deprecated.booleanusesMultifile()Deprecated.booleanusesRuleChain()Deprecated.booleanusesTypeResolution()Deprecated.-
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, useDefaultValueFor, usesDefaultValues
-
-
-
-
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:RuleGet the Language of this Rule.- Specified by:
getLanguagein interfaceRule- Returns:
- the language
-
setLanguage
public void setLanguage(Language language)
Deprecated.Description copied from interface:RuleSet the Language of this Rule.- Specified by:
setLanguagein interfaceRule- Parameters:
language- the language
-
getMinimumLanguageVersion
public LanguageVersion getMinimumLanguageVersion()
Deprecated.Description copied from interface:RuleGet the minimum LanguageVersion to which this Rule applies. If this value isnullit indicates there is no minimum bound.- Specified by:
getMinimumLanguageVersionin interfaceRule- Returns:
- the minimum language version
-
setMinimumLanguageVersion
public void setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)
Deprecated.Description copied from interface:RuleSet the minimum LanguageVersion to which this Rule applies.- Specified by:
setMinimumLanguageVersionin interfaceRule- Parameters:
minimumlanguageVersion- the minimum language version
-
getMaximumLanguageVersion
public LanguageVersion getMaximumLanguageVersion()
Deprecated.Description copied from interface:RuleGet the maximum LanguageVersion to which this Rule applies. If this value isnullit indicates there is no maximum bound.- Specified by:
getMaximumLanguageVersionin interfaceRule- Returns:
- the maximum language version
-
setMaximumLanguageVersion
public void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)
Deprecated.Description copied from interface:RuleSet the maximum LanguageVersion to which this Rule applies.- Specified by:
setMaximumLanguageVersionin interfaceRule- Parameters:
maximumlanguageVersion- the maximum language version
-
isDeprecated
public boolean isDeprecated()
Deprecated.Description copied from interface:RuleGets 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:
isDeprecatedin interfaceRule- Returns:
trueif this rule is deprecated
-
setDeprecated
public void setDeprecated(boolean deprecated)
Deprecated.Description copied from interface:RuleSets whether this Rule is deprecated.- Specified by:
setDeprecatedin interfaceRule- Parameters:
deprecated- whether this rule is deprecated
-
dysfunctionReason
public String dysfunctionReason()
Deprecated.Description copied from interface:PropertySourceReturns 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:
dysfunctionReasonin interfacePropertySource- Returns:
- String
- See Also:
PropertySource.dysfunctionReason()
-
ignoredProperties
public Set<PropertyDescriptor<?>> ignoredProperties()
Deprecated.Description copied from interface:PropertySourceReturn the properties that are effectively ignored due to the configuration of the rule and values held by other properties. This can be used to disable corresponding widgets in a UI.- Specified by:
ignoredPropertiesin interfacePropertySource- Returns:
- the properties that are ignored
-
getName
public String getName()
Deprecated.Description copied from interface:RuleGet the name of this Rule.- Specified by:
getNamein interfacePropertySource- Specified by:
getNamein interfaceRule- Returns:
- the name
-
setName
public void setName(String name)
Deprecated.Description copied from interface:RuleSet the name of this Rule.
-
getSince
public String getSince()
Deprecated.Description copied from interface:RuleGet the version of PMD in which this Rule was added. Returnnullif not applicable.
-
setSince
public void setSince(String since)
Deprecated.Description copied from interface:RuleSet the version of PMD in which this Rule was added.
-
getRuleClass
public String getRuleClass()
Deprecated.Description copied from interface:RuleGet the implementation class of this Rule.- Specified by:
getRuleClassin interfaceRule- Returns:
- the implementation class name of this rule.
-
setRuleClass
public void setRuleClass(String ruleClass)
Deprecated.Description copied from interface:RuleSet the class of this Rule.- Specified by:
setRuleClassin interfaceRule- Parameters:
ruleClass- the class name of this rule.
-
getRuleSetName
public String getRuleSetName()
Deprecated.Description copied from interface:RuleGet the name of the RuleSet containing this Rule.- Specified by:
getRuleSetNamein interfaceRule- Returns:
- the name of th ruleset containing this rule.
- See Also:
RuleSet
-
setRuleSetName
public void setRuleSetName(String name)
Deprecated.Description copied from interface:RuleSet the name of the RuleSet containing this Rule.- Specified by:
setRuleSetNamein interfaceRule- Parameters:
name- the name of the ruleset containing this rule.- See Also:
RuleSet
-
getMessage
public String getMessage()
Deprecated.Description copied from interface:RuleGet the message to show when this Rule identifies a violation.- Specified by:
getMessagein interfaceRule- Returns:
- the message to show for a violation.
-
setMessage
public void setMessage(String message)
Deprecated.Description copied from interface:RuleSet the message to show when this Rule identifies a violation.- Specified by:
setMessagein interfaceRule- Parameters:
message- the message to show for a violation.
-
getDescription
public String getDescription()
Deprecated.Description copied from interface:RuleGet the description of this Rule.- Specified by:
getDescriptionin interfaceRule- Returns:
- the description
-
setDescription
public void setDescription(String description)
Deprecated.Description copied from interface:RuleSet the description of this Rule.- Specified by:
setDescriptionin interfaceRule- Parameters:
description- the description
-
getExamples
public List<String> getExamples()
Deprecated.Description copied from interface:RuleGet the list of examples for this Rule.- Specified by:
getExamplesin interfaceRule- Returns:
- the list of examples for this rule.
-
addExample
public void addExample(String example)
Deprecated.Description copied from interface:RuleAdd a single example for this Rule.- Specified by:
addExamplein interfaceRule- Parameters:
example- a single example to add
-
getExternalInfoUrl
public String getExternalInfoUrl()
Deprecated.Description copied from interface:RuleGet a URL for external information about this Rule.- Specified by:
getExternalInfoUrlin interfaceRule- Returns:
- the URL for external information about this rule.
-
setExternalInfoUrl
public void setExternalInfoUrl(String url)
Deprecated.Description copied from interface:RuleSet a URL for external information about this Rule.- Specified by:
setExternalInfoUrlin interfaceRule- Parameters:
url- the URL for external information about this rule.
-
getPriority
public RulePriority getPriority()
Deprecated.Description copied from interface:RuleGet the priority of this Rule.- Specified by:
getPriorityin interfaceRule- Returns:
- the priority
-
setPriority
public void setPriority(RulePriority priority)
Deprecated.Description copied from interface:RuleSet the priority of this Rule.- Specified by:
setPriorityin interfaceRule- Parameters:
priority- the priority
-
getParserOptions
public ParserOptions getParserOptions()
Deprecated.Description copied from interface:RuleGet the parser options for this Rule. Parser options are used to configure theParserto create an AST in the form the Rule is expecting. Because ParserOptions are mutable, a Rule should return a new instance on each call.- Specified by:
getParserOptionsin interfaceRule- Returns:
- the parser options
-
definePropertyDescriptor
public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor) throws IllegalArgumentException
Deprecated.Description copied from interface:PropertySourceDefines a new property. Properties must be defined before they can be set a value.- Specified by:
definePropertyDescriptorin 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:PropertySourceGet the PropertyDescriptor for the given property name.- Specified by:
getPropertyDescriptorin interfacePropertySource- Parameters:
name- The name of the property.- Returns:
- The PropertyDescriptor for the named property,
nullif there is no such property defined.
-
getPropertyDescriptors
public List<PropertyDescriptor<?>> getPropertyDescriptors()
Deprecated.Description copied from interface:PropertySourceGet the descriptors of all defined properties. The properties are returned sorted by UI order.- Specified by:
getPropertyDescriptorsin interfacePropertySource- Returns:
- The PropertyDescriptors in UI order.
-
getProperty
public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
Deprecated.Description copied from interface:PropertySourceGet the typed value for the given property. Multi valued properties return immutable lists.- Specified by:
getPropertyin 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:PropertySourceSet the property value specified. This is also referred to as "overriding" the (default) value of a property.- Specified by:
setPropertyin 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:PropertySourceSets 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:
setPropertyin 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:PropertySourceReturns true if the given property has been set to a value somewhere in the XML.- Specified by:
isPropertyOverriddenin interfacePropertySource- Parameters:
propertyDescriptor- The descriptor- Returns:
- True if the property has been set
-
getPropertiesByPropertyDescriptor
public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
Deprecated.Description copied from interface:PropertySourceReturns 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:
getPropertiesByPropertyDescriptorin interfacePropertySource- Returns:
- An unmodifiable map of descriptors to property values
-
setUsesDFA
@Deprecated public void setUsesDFA()
Deprecated.Description copied from interface:RuleSets whether this Rule uses Data Flow Analysis.- Specified by:
setUsesDFAin interfaceRule
-
setDfa
public void setDfa(boolean isDfa)
Deprecated.Description copied from interface:RuleSets whether this Rule uses Data Flow Analysis.
-
usesDFA
@Deprecated public boolean usesDFA()
Deprecated.Description copied from interface:RuleGets whether this Rule uses Data Flow Analysis.
-
isDfa
public boolean isDfa()
Deprecated.Description copied from interface:RuleGets whether this Rule uses Data Flow Analysis.
-
setUsesTypeResolution
@Deprecated public void setUsesTypeResolution()
Deprecated.Description copied from interface:RuleSets whether this Rule uses Type Resolution.- Specified by:
setUsesTypeResolutionin interfaceRule
-
setTypeResolution
public void setTypeResolution(boolean usingTypeResolution)
Deprecated.Description copied from interface:RuleSets whether this Rule uses Type Resolution.- Specified by:
setTypeResolutionin interfaceRule
-
usesTypeResolution
@Deprecated public boolean usesTypeResolution()
Deprecated.Description copied from interface:RuleGets whether this Rule uses Type Resolution.- Specified by:
usesTypeResolutionin interfaceRule- Returns:
trueif Type Resolution is used.
-
isTypeResolution
public boolean isTypeResolution()
Deprecated.Description copied from interface:RuleGets whether this Rule uses Type Resolution.- Specified by:
isTypeResolutionin interfaceRule- Returns:
trueif Type Resolution is used.
-
setUsesMultifile
@Deprecated public void setUsesMultifile()
Deprecated.Description copied from interface:RuleSets whether this Rule uses multi-file analysis.- Specified by:
setUsesMultifilein interfaceRule
-
setMultifile
public void setMultifile(boolean multifile)
Deprecated.Description copied from interface:RuleSets whether this Rule uses multi-file analysis.- Specified by:
setMultifilein interfaceRule
-
usesMultifile
@Deprecated public boolean usesMultifile()
Deprecated.Description copied from interface:RuleGets whether this Rule uses multi-file analysis.- Specified by:
usesMultifilein interfaceRule- Returns:
trueif the multi file analysis is used.
-
isMultifile
public boolean isMultifile()
Deprecated.Description copied from interface:RuleGets whether this Rule uses multi-file analysis.- Specified by:
isMultifilein interfaceRule- Returns:
trueif the multi file analysis is used.
-
usesRuleChain
@Deprecated public boolean usesRuleChain()
Deprecated.Description copied from interface:RuleGets whether this Rule uses the RuleChain.- Specified by:
usesRuleChainin interfaceRule- Returns:
trueif RuleChain is used.
-
isRuleChain
public boolean isRuleChain()
Deprecated.Description copied from interface:RuleGets whether this Rule uses the RuleChain.- Specified by:
isRuleChainin interfaceRule- Returns:
trueif RuleChain is used.
-
getRuleChainVisits
public List<String> getRuleChainVisits()
Deprecated.Description copied from interface:RuleGets the collection of AST node names visited by the Rule on the RuleChain.- Specified by:
getRuleChainVisitsin interfaceRule- Returns:
- the list of AST node names
-
addRuleChainVisit
public void addRuleChainVisit(Class<? extends Node> nodeClass)
Deprecated.Description copied from interface:RuleAdds an AST node by class to be visited by the Rule on the RuleChain.- Specified by:
addRuleChainVisitin interfaceRule- Parameters:
nodeClass- the AST node to add to the RuleChain visit list
-
addRuleChainVisit
public void addRuleChainVisit(String astNodeName)
Deprecated.Description copied from interface:RuleAdds an AST node by name to be visited by the Rule on the RuleChain.- Specified by:
addRuleChainVisitin interfaceRule- Parameters:
astNodeName- the AST node to add to the RuleChain visit list as string
-
start
public void start(RuleContext ctx)
Deprecated.Description copied from interface:RuleStart processing. Called once, before apply() is first called.
-
apply
public void apply(List<? extends Node> nodes, RuleContext ctx)
Deprecated.Description copied from interface:RuleApply this rule to the given collection of nodes, using the given context.
-
end
public void end(RuleContext ctx)
Deprecated.Description copied from interface:RuleEnd processing. Called once, after apply() is last called.
-
hasDescriptor
public boolean hasDescriptor(PropertyDescriptor<?> descriptor)
Deprecated.Description copied from interface:PropertySourceReturns 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:
hasDescriptorin interfacePropertySource- Parameters:
descriptor- The descriptor to look for- Returns:
trueif the descriptor is defined,falseotherwise.- See Also:
PropertySource.hasDescriptor(PropertyDescriptor)
-
-