Class RuleFactory


  • @InternalApi
    @Deprecated
    public class RuleFactory
    extends Object
    Deprecated.
    Builds rules from rule XML nodes.
    Since:
    6.0.0
    Author:
    Clément Fournier
    • Constructor Detail

      • RuleFactory

        public RuleFactory​(ResourceLoader resourceLoader,
                           LanguageRegistry languageRegistry)
        Deprecated.
        Parameters:
        resourceLoader - The resource loader to load the rule from jar
    • Method Detail

      • decorateRule

        public RuleReference decorateRule​(Rule referencedRule,
                                          RuleSetReference ruleSetReference,
                                          Element ruleElement,
                                          PmdXmlReporter err)
        Deprecated.
        Decorates a referenced rule with the metadata that are overridden in the given rule element.

        Declaring a property in the overriding element throws an exception (the property must exist in the referenced rule).

        Parameters:
        referencedRule - Referenced rule
        ruleSetReference - the ruleset, where the referenced rule is defined
        ruleElement - Element overriding some metadata about the rule
        err - Error reporter
        Returns:
        A rule reference to the referenced rule
      • buildRule

        public Rule buildRule​(Element ruleElement,
                              PmdXmlReporter err)
        Deprecated.
        Parses a rule element and returns a new rule instance.

        Notes: The ruleset name is not set here. Exceptions raised from this method indicate invalid XML structure, with regards to the expected schema, while RuleBuilder validates the semantics.

        Parameters:
        ruleElement - The rule element to parse
        Returns:
        A new instance of the rule described by this element
        Throws:
        IllegalArgumentException - if the element doesn't describe a valid rule.
      • parsePriority

        public static @Nullable RulePriority parsePriority​(PmdXmlReporter err,
                                                           Element node)
        Deprecated.
        Parse a priority. If invalid, report it and return null.