Class RuleSetFactory


  • @Deprecated
    public class RuleSetFactory
    extends Object
    Deprecated.
    Use a RuleSetLoader instead. This will be hidden in PMD 7 (it's the implementation, while RuleSetLoader is the API).
    RuleSetFactory is responsible for creating RuleSet instances from XML content. See RuleSetLoader for configuration options and their defaults.
    • Constructor Detail

      • RuleSetFactory

        @Deprecated
        public RuleSetFactory​(RuleSetFactory factory,
                              boolean warnDeprecated)
        Deprecated.
        Use toLoader() to rebuild a factory from a configuration
        Constructor copying all configuration from another factory.
        Parameters:
        factory - The factory whose configuration to copy.
        warnDeprecated - Whether deprecation warnings are to be produced by this factory
    • Method Detail

      • createRuleSets

        @Deprecated
        public RuleSets createRuleSets​(List<RuleSetReferenceId> ruleSetReferenceIds)
                                throws RuleSetNotFoundException
        Deprecated.
        Will not be replaced
        Create a RuleSets from a list of RuleSetReferenceIds. The currently configured ResourceLoader is used.
        Parameters:
        ruleSetReferenceIds - The List of RuleSetReferenceId of the RuleSets to create.
        Returns:
        The new RuleSets.
        Throws:
        RuleSetNotFoundException - if unable to find a resource.
      • createRuleSet

        @Deprecated
        public RuleSet createRuleSet​(RuleSetReferenceId ruleSetReferenceId)
                              throws RuleSetNotFoundException
        Deprecated.
        Will not be replaced
        Create a RuleSet from a RuleSetReferenceId. Priority filtering is ignored when loading a single Rule. The currently configured ResourceLoader is used.
        Parameters:
        ruleSetReferenceId - The RuleSetReferenceId of the RuleSet to create.
        Returns:
        A new RuleSet.
        Throws:
        RuleSetNotFoundException - if unable to find a resource.
      • createRuleSetCopy

        @Deprecated
        public RuleSet createRuleSetCopy​(RuleSet original)
        Deprecated.
        Creates a copy of the given ruleset. All properties like name, description, fileName and exclude/include patterns are copied.

        Note: The rule instances are shared between the original and the new ruleset (copy-by-reference). This might lead to concurrency issues, if the original ruleset and the new ruleset are used in different threads.

        Parameters:
        original - the original rule set to copy from
        Returns:
        the copy
      • createNewRuleSet

        @Deprecated
        public RuleSet createNewRuleSet​(String name,
                                        String description,
                                        String fileName,
                                        Collection<String> excludePatterns,
                                        Collection<String> includePatterns,
                                        Collection<Rule> rules)
        Creates a new ruleset with the given metadata such as name, description, fileName, exclude/include patterns are used. The rules are taken from the given collection.

        Note: The rule instances are shared between the collection and the new ruleset (copy-by-reference). This might lead to concurrency issues, if the rules of the collection are also referenced by other rulesets and used in different threads.

        Parameters:
        name - the name of the ruleset
        description - the description
        fileName - the filename
        excludePatterns - list of exclude patterns, if any is not a valid regular expression, it will be ignored
        includePatterns - list of include patterns, if any is not a valid regular expression, it will be ignored
        rules - the collection with the rules to add to the new ruleset
        Returns:
        the new ruleset
      • createSingleRuleRuleSet

        @Deprecated
        public RuleSet createSingleRuleRuleSet​(Rule rule)
        Creates a new RuleSet containing a single rule.
        Parameters:
        rule - The rule being created
        Returns:
        The newly created RuleSet
      • toLoader

        public RuleSetLoader toLoader()
        Deprecated.
        Create a new RuleSetLoader with the same config as this factory. This is a transitional API.