|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.pmd.lang.rule.AbstractDelegateRule
net.sourceforge.pmd.lang.rule.RuleReference
public class RuleReference
This class represents a Rule which is a reference to Rule defined in another RuleSet. All details of the Rule are delegated to the underlying referenced Rule, but those operations which modify overridden aspects of the rule are explicitly tracked. Modification operations which set a value to the current underlying value do not override.
| Field Summary |
|---|
| Fields inherited from interface net.sourceforge.pmd.Rule |
|---|
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR |
| Constructor Summary | |
|---|---|
RuleReference()
|
|
RuleReference(Rule theRule,
RuleSetReference theRuleSetReference)
|
|
| Method Summary | ||
|---|---|---|
void |
addExample(String example)
Add a single example for this Rule. |
|
void |
definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
Define a new property via a PropertyDescriptor. |
|
String |
getName()
Get the name of this Rule. |
|
String |
getOriginalName()
|
|
String |
getOverriddenDescription()
|
|
List<String> |
getOverriddenExamples()
|
|
String |
getOverriddenExternalInfoUrl()
|
|
Language |
getOverriddenLanguage()
|
|
LanguageVersion |
getOverriddenMaximumLanguageVersion()
|
|
String |
getOverriddenMessage()
|
|
LanguageVersion |
getOverriddenMinimumLanguageVersion()
|
|
String |
getOverriddenName()
|
|
RulePriority |
getOverriddenPriority()
|
|
Map<PropertyDescriptor<?>,Object> |
getOverriddenPropertiesByPropertyDescriptor()
|
|
List<PropertyDescriptor<?>> |
getOverriddenPropertyDescriptors()
|
|
RuleSetReference |
getRuleSetReference()
|
|
boolean |
hasDescriptor(PropertyDescriptor<?> descriptor)
Returns whether this Rule has the specified PropertyDescriptor. |
|
boolean |
hasOverriddenProperty(PropertyDescriptor<?> descriptor)
|
|
boolean |
isDeprecated()
Gets whether this Rule is deprecated. |
|
Boolean |
isOverriddenDeprecated()
|
|
void |
setDeprecated(boolean deprecated)
Sets whether this Rule is deprecated. |
|
void |
setDescription(String description)
Set the description of this Rule. |
|
void |
setExternalInfoUrl(String externalInfoUrl)
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 |
setRuleSetReference(RuleSetReference ruleSetReference)
|
|
void |
useDefaultValueFor(PropertyDescriptor<?> desc)
Clears out any user-specified value for the property allowing it to use the default value in the descriptor. |
|
boolean |
usesDefaultValues()
Returns whether this Rule uses default values for properties. |
|
| Methods inherited from class net.sourceforge.pmd.lang.rule.AbstractDelegateRule |
|---|
addRuleChainVisit, addRuleChainVisit, apply, dysfunctionReason, end, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getParserOptions, getPriority, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, getRule, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, ignoredProperties, setRule, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, start, usesDFA, usesRuleChain, usesTypeResolution |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RuleReference()
public RuleReference(Rule theRule,
RuleSetReference theRuleSetReference)
| Method Detail |
|---|
public Language getOverriddenLanguage()
public void setLanguage(Language language)
Rule
setLanguage in interface RulesetLanguage in class AbstractDelegateRulelanguage - the languagepublic LanguageVersion getOverriddenMinimumLanguageVersion()
public void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
Rule
setMinimumLanguageVersion in interface RulesetMinimumLanguageVersion in class AbstractDelegateRuleminimumLanguageVersion - the minimum language versionpublic LanguageVersion getOverriddenMaximumLanguageVersion()
public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
Rule
setMaximumLanguageVersion in interface RulesetMaximumLanguageVersion in class AbstractDelegateRulemaximumLanguageVersion - the maximum language versionpublic Boolean isOverriddenDeprecated()
public boolean isDeprecated()
Rule
isDeprecated in interface RuleisDeprecated in class AbstractDelegateRuletrue if this rule is deprecatedpublic void setDeprecated(boolean deprecated)
Rule
setDeprecated in interface RulesetDeprecated in class AbstractDelegateRuledeprecated - whether this rule is deprecatedpublic String getOverriddenName()
public String getOriginalName()
public void setName(String name)
Rule
setName in interface RulesetName in class AbstractDelegateRulename - the namepublic String getName()
Rule
getName in interface RulegetName in class AbstractDelegateRulepublic String getOverriddenMessage()
public void setMessage(String message)
Rule
setMessage in interface RulesetMessage in class AbstractDelegateRulemessage - the message to show for a violation.public String getOverriddenDescription()
public void setDescription(String description)
Rule
setDescription in interface RulesetDescription in class AbstractDelegateRuledescription - the descriptionpublic List<String> getOverriddenExamples()
public void addExample(String example)
Rule
addExample in interface RuleaddExample in class AbstractDelegateRuleexample - a single example to addpublic String getOverriddenExternalInfoUrl()
public void setExternalInfoUrl(String externalInfoUrl)
Rule
setExternalInfoUrl in interface RulesetExternalInfoUrl in class AbstractDelegateRuleexternalInfoUrl - the URL for external information about this rule.public RulePriority getOverriddenPriority()
public void setPriority(RulePriority priority)
Rule
setPriority in interface RulesetPriority in class AbstractDelegateRulepriority - the prioritypublic List<PropertyDescriptor<?>> getOverriddenPropertyDescriptors()
public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
throws IllegalArgumentException
PropertySource
definePropertyDescriptor in interface PropertySourcedefinePropertyDescriptor in class AbstractDelegateRulepropertyDescriptor - The property descriptor.
IllegalArgumentException - If there is already a property defined
the same name.public Map<PropertyDescriptor<?>,Object> getOverriddenPropertiesByPropertyDescriptor()
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor,
T value)
PropertySource
setProperty in interface PropertySourcesetProperty in class AbstractDelegateRuleT - The underlying type of the property descriptor.propertyDescriptor - The property descriptor.value - The value to set.public RuleSetReference getRuleSetReference()
public void setRuleSetReference(RuleSetReference ruleSetReference)
public boolean hasDescriptor(PropertyDescriptor<?> descriptor)
PropertySource
hasDescriptor in interface PropertySourcehasDescriptor in class AbstractDelegateRuledescriptor - The PropertyDescriptor for which to check.
true if the descriptor is present,
false otherwise.PropertySource.hasDescriptor(PropertyDescriptor)public boolean hasOverriddenProperty(PropertyDescriptor<?> descriptor)
public boolean usesDefaultValues()
PropertySource
true if the properties all have default
values, false otherwise.public void useDefaultValueFor(PropertyDescriptor<?> desc)
PropertySource
desc - the property to clear out
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||