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

      public abstract class AbstractDelegateRule
      extends Object
      implements Rule

  Base 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 and Description
    `AbstractDelegateRule()`

  - ### Method Summary

    Methods
    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 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.

    - ### 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.PropertySource

      `useDefaultValueFor, usesDefaultValues`

- - ### Constructor Detail

    - #### AbstractDelegateRule

          public AbstractDelegateRule()

  - ### Method Detail

    - #### setRule

          public void setRule(Rule rule)

    - #### getRule

          public Rule getRule()

    - #### getLanguage

          public Language getLanguage()

      Description copied from interface: `Rule`
      Get the Language of this Rule.
      Specified by:
        `getLanguage` in interface `Rule`

    - #### setLanguage

          public void setLanguage(Language language)

      Description copied from interface: `Rule`
      Set the Language of this Rule.
      Specified by:
        `setLanguage` in interface `Rule`

    - #### getMinimumLanguageVersion

          public LanguageVersion getMinimumLanguageVersion()

      Description copied from interface: `Rule`
      Get the minimum LanguageVersion to which this Rule applies. If this value is `null` it indicates there is no minimum bound.
      Specified by:
        `getMinimumLanguageVersion` in interface `Rule`

    - #### setMinimumLanguageVersion

          public void setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion)

      Description copied from interface: `Rule`
      Set the minimum LanguageVersion to which this Rule applies.
      Specified by:
        `setMinimumLanguageVersion` in interface `Rule`

    - #### setMaximumLanguageVersion

          public void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion)

      Description copied from interface: `Rule`
      Set the maximum LanguageVersion to which this Rule applies.
      Specified by:
        `setMaximumLanguageVersion` in interface `Rule`

    - #### getMaximumLanguageVersion

          public LanguageVersion getMaximumLanguageVersion()

      Description copied from interface: `Rule`
      Get the maximum LanguageVersion to which this Rule applies. If this value is `null` it indicates there is no maximum bound.
      Specified by:
        `getMaximumLanguageVersion` in interface `Rule`

    - #### isDeprecated

          public boolean isDeprecated()

      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 interface `Rule`

    - #### dysfunctionReason

          public String dysfunctionReason()

      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 interface `PropertySource`
      Returns:
        String
      See Also:
        `PropertySource.dysfunctionReason()`

    - #### ignoredProperties

          public Set<PropertyDescriptor<?>> ignoredProperties()

      Description copied from interface: `PropertySource`
      Return 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:
        `ignoredProperties` in interface `PropertySource`

    - #### setDeprecated

          public void setDeprecated(boolean deprecated)

      Description copied from interface: `Rule`
      Sets whether this Rule is deprecated.
      Specified by:
        `setDeprecated` in interface `Rule`

    - #### getName

          public String getName()

      Description copied from interface: `Rule`
      Get the name of this Rule.
      Specified by:
        `getName` in interface `Rule`

    - #### setName

          public void setName(String name)

      Description copied from interface: `Rule`
      Set the name of this Rule.
      Specified by:
        `setName` in interface `Rule`

    - #### getSince

          public String getSince()

      Description copied from interface: `Rule`
      Get the version of PMD in which this Rule was added. Return `null` if not applicable.
      Specified by:
        `getSince` in interface `Rule`

    - #### setSince

          public void setSince(String since)

      Description copied from interface: `Rule`
      Set the version of PMD in which this Rule was added.
      Specified by:
        `setSince` in interface `Rule`

    - #### getRuleClass

          public String getRuleClass()

      Description copied from interface: `Rule`
      Get the class of this Rule.
      Specified by:
        `getRuleClass` in interface `Rule`

    - #### setRuleClass

          public void setRuleClass(String ruleClass)

      Description copied from interface: `Rule`
      Set the class of this Rule.
      Specified by:
        `setRuleClass` in interface `Rule`

    - #### getRuleSetName

          public String getRuleSetName()

      Description copied from interface: `Rule`
      Get the name of the RuleSet containing this Rule.
      Specified by:
        `getRuleSetName` in interface `Rule`
      See Also:
        `RuleSet`

    - #### setRuleSetName

          public void setRuleSetName(String name)

      Description copied from interface: `Rule`
      Set the name of the RuleSet containing this Rule.
      Specified by:
        `setRuleSetName` in interface `Rule`
      See Also:
        `RuleSet`

    - #### getMessage

          public String getMessage()

      Description copied from interface: `Rule`
      Get the message to show when this Rule identifies a violation.
      Specified by:
        `getMessage` in interface `Rule`

    - #### setMessage

          public void setMessage(String message)

      Description copied from interface: `Rule`
      Set the message to show when this Rule identifies a violation.
      Specified by:
        `setMessage` in interface `Rule`

    - #### getDescription

          public String getDescription()

      Description copied from interface: `Rule`
      Get the description of this Rule.
      Specified by:
        `getDescription` in interface `Rule`

    - #### setDescription

          public void setDescription(String description)

      Description copied from interface: `Rule`
      Set the description of this Rule.
      Specified by:
        `setDescription` in interface `Rule`

    - #### getExamples

          public List<String> getExamples()

      Description copied from interface: `Rule`
      Get the list of examples for this Rule.
      Specified by:
        `getExamples` in interface `Rule`

    - #### addExample

          public void addExample(String example)

      Description copied from interface: `Rule`
      Add a single example for this Rule.
      Specified by:
        `addExample` in interface `Rule`

    - #### getExternalInfoUrl

          public String getExternalInfoUrl()

      Description copied from interface: `Rule`
      Get a URL for external information about this Rule.
      Specified by:
        `getExternalInfoUrl` in interface `Rule`

    - #### setExternalInfoUrl

          public void setExternalInfoUrl(String url)

      Description copied from interface: `Rule`
      Set a URL for external information about this Rule.
      Specified by:
        `setExternalInfoUrl` in interface `Rule`

    - #### getPriority

          public RulePriority getPriority()

      Description copied from interface: `Rule`
      Get the priority of this Rule.
      Specified by:
        `getPriority` in interface `Rule`

    - #### setPriority

          public void setPriority(RulePriority priority)

      Description copied from interface: `Rule`
      Set the priority of this Rule.
      Specified by:
        `setPriority` in interface `Rule`

    - #### getParserOptions

          public ParserOptions getParserOptions()

      Description copied from interface: `Rule`
      Get the parser options for this Rule. Parser options are used to configure the `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.
      Specified by:
        `getParserOptions` in interface `Rule`

    - #### definePropertyDescriptor

          public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
                                        throws IllegalArgumentException

      Description copied from interface: `PropertySource`
      Define a new property via a PropertyDescriptor.
      Specified by:
        `definePropertyDescriptor` in interface `PropertySource`
      Parameters:
        `propertyDescriptor` - The property descriptor.
      Throws:
        `IllegalArgumentException` - If there is already a property defined the same name.

    - #### getPropertyDescriptor

          public PropertyDescriptor<?> getPropertyDescriptor(String name)

      Description copied from interface: `PropertySource`
      Get the PropertyDescriptor for the given property name.
      Specified by:
        `getPropertyDescriptor` in interface `PropertySource`
      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()

      Description copied from interface: `PropertySource`
      Get the PropertyDescriptors for all defined properties. The properties are returned sorted by UI order.
      Specified by:
        `getPropertyDescriptors` in interface `PropertySource`
      Returns:
        The PropertyDescriptors in UI order.

    - #### getProperty

          public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)

      Description copied from interface: `PropertySource`
      Get the typed value for the given property.
      Specified by:
        `getProperty` in interface `PropertySource`
      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)

      Description copied from interface: `PropertySource`
      Set the property value specified (will be type-checked)
      Specified by:
        `setProperty` in interface `PropertySource`
      Type Parameters:
        `T` - The underlying type of the property descriptor.
      Parameters:
        `propertyDescriptor` - The property descriptor.
        `value` - The value to set.

    - #### getPropertiesByPropertyDescriptor

          public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()

      Description copied from interface: `PropertySource`
      Returns all the current property values for the receiver or an immutable empty map if none are specified.
      Specified by:
        `getPropertiesByPropertyDescriptor` in interface `PropertySource`

    - #### setUsesDFA

          public void setUsesDFA()

      Description copied from interface: `Rule`
      Sets whether this Rule uses Data Flow Analysis.
      Specified by:
        `setUsesDFA` in interface `Rule`

    - #### usesDFA

          public boolean usesDFA()

      Description copied from interface: `Rule`
      Gets whether this Rule uses Data Flow Analysis.
      Specified by:
        `usesDFA` in interface `Rule`

    - #### setUsesTypeResolution

          public void setUsesTypeResolution()

      Description copied from interface: `Rule`
      Sets whether this Rule uses Type Resolution.
      Specified by:
        `setUsesTypeResolution` in interface `Rule`

    - #### usesTypeResolution

          public boolean usesTypeResolution()

      Description copied from interface: `Rule`
      Gets whether this Rule uses Type Resolution.
      Specified by:
        `usesTypeResolution` in interface `Rule`

    - #### usesRuleChain

          public boolean usesRuleChain()

      Description copied from interface: `Rule`
      Gets whether this Rule uses the RuleChain.
      Specified by:
        `usesRuleChain` in interface `Rule`

    - #### getRuleChainVisits

          public List<String> getRuleChainVisits()

      Description copied from interface: `Rule`
      Gets the collection of AST node names visited by the Rule on the RuleChain.
      Specified by:
        `getRuleChainVisits` in interface `Rule`

    - #### addRuleChainVisit

          public void addRuleChainVisit(Class<? extends Node> nodeClass)

      Description copied from interface: `Rule`
      Adds an AST node by class to be visited by the Rule on the RuleChain.
      Specified by:
        `addRuleChainVisit` in interface `Rule`

    - #### addRuleChainVisit

          public void addRuleChainVisit(String astNodeName)

      Description copied from interface: `Rule`
      Adds an AST node by name to be visited by the Rule on the RuleChain.
      Specified by:
        `addRuleChainVisit` in interface `Rule`

    - #### start

          public void start(RuleContext ctx)

      Description copied from interface: `Rule`
      Start processing. Called once, before apply() is first called.
      Specified by:
        `start` in interface `Rule`

    - #### apply

          public void apply(List<? extends Node> nodes,
                   RuleContext ctx)

      Description copied from interface: `Rule`
      Apply this rule to the given collection of nodes, using the given context.
      Specified by:
        `apply` in interface `Rule`

    - #### end

          public void end(RuleContext ctx)

      Description copied from interface: `Rule`
      End processing. Called once, after apply() is last called.
      Specified by:
        `end` in interface `Rule`

    - #### hasDescriptor

          public boolean hasDescriptor(PropertyDescriptor<?> descriptor)

      Description copied from interface: `PropertySource`
      Returns whether this Rule has the specified PropertyDescriptor.
      Specified by:
        `hasDescriptor` in interface `PropertySource`
      Parameters:
        `descriptor` - The PropertyDescriptor for which to check.
      Returns:
        boolean `true` if the descriptor is present, `false` otherwise.
      See Also:
        `PropertySource.hasDescriptor(PropertyDescriptor)`

Copyright © 2002-2013 InfoEther. All Rights Reserved.