Package net.sourceforge.pmd
Class RuleSetFactory
- java.lang.Object
-
- net.sourceforge.pmd.RuleSetFactory
-
@Deprecated public class RuleSetFactory extends Object
Deprecated.Use aRuleSetLoader
instead. This will be hidden in PMD 7 (it's the implementation, whileRuleSetLoader
is the API).RuleSetFactory is responsible for creating RuleSet instances from XML content. SeeRuleSetLoader
for configuration options and their defaults.
-
-
Constructor Summary
Constructors Constructor Description RuleSetFactory()
Deprecated.Use aRuleSetLoader
to build a new factoryRuleSetFactory(ClassLoader classLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
Deprecated.Use aRuleSetLoader
to build a new factoryRuleSetFactory(RuleSetFactory factory, boolean warnDeprecated)
Deprecated.UsetoLoader()
to rebuild a factory from a configurationRuleSetFactory(ResourceLoader resourceLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
Deprecated.Use aRuleSetLoader
to build a new factory
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RuleSet
createNewRuleSet(String name, String description, String fileName, Collection<String> excludePatterns, Collection<String> includePatterns, Collection<Rule> rules)
RuleSet
createRuleSet(String referenceString)
Deprecated.UseRuleSetLoader.loadFromResource(String)
and discard the rest of the list.RuleSet
createRuleSet(RuleSetReferenceId ruleSetReferenceId)
Deprecated.Will not be replacedRuleSet
createRuleSetCopy(RuleSet original)
Deprecated.RuleSets
createRuleSets(String referenceString)
Deprecated.UseRuleSetLoader.loadFromResource(String)
, but note that that method does not split on commasRuleSets
createRuleSets(List<RuleSetReferenceId> ruleSetReferenceIds)
Deprecated.Will not be replacedRuleSet
createSingleRuleRuleSet(Rule rule)
Deprecated.Iterator<RuleSet>
getRegisteredRuleSets()
Deprecated.RuleSetLoader
toLoader()
Deprecated.Create a newRuleSetLoader
with the same config as this factory.
-
-
-
Constructor Detail
-
RuleSetFactory
@Deprecated public RuleSetFactory()
Deprecated.Use aRuleSetLoader
to build a new factory
-
RuleSetFactory
@Deprecated public RuleSetFactory(ClassLoader classLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
Deprecated.Use aRuleSetLoader
to build a new factory
-
RuleSetFactory
@Deprecated public RuleSetFactory(ResourceLoader resourceLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
Deprecated.Use aRuleSetLoader
to build a new factory
-
RuleSetFactory
@Deprecated public RuleSetFactory(RuleSetFactory factory, boolean warnDeprecated)
Deprecated.UsetoLoader()
to rebuild a factory from a configurationConstructor 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
-
getRegisteredRuleSets
@Deprecated public Iterator<RuleSet> getRegisteredRuleSets() throws RuleSetNotFoundException
Deprecated.Returns an Iterator of RuleSet objects loaded from descriptions from the "categories.properties" resource for each Language with Rule support.- Returns:
- An Iterator of RuleSet objects.
- Throws:
RuleSetNotFoundException
- if the ruleset file could not be found
-
createRuleSets
@Deprecated public RuleSets createRuleSets(String referenceString) throws RuleSetNotFoundException
Deprecated.UseRuleSetLoader.loadFromResource(String)
, but note that that method does not split on commasCreate a RuleSets from a comma separated list of RuleSet reference IDs. This is a convenience method which callsRuleSetReferenceId.parse(String)
, and then callscreateRuleSets(List)
. The currently configured ResourceLoader is used.- Parameters:
referenceString
- A comma separated list of RuleSet reference IDs.- Returns:
- The new RuleSets.
- Throws:
RuleSetNotFoundException
- if unable to find a resource.
-
createRuleSets
@Deprecated public RuleSets createRuleSets(List<RuleSetReferenceId> ruleSetReferenceIds) throws RuleSetNotFoundException
Deprecated.Will not be replacedCreate 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(String referenceString) throws RuleSetNotFoundException
Deprecated.UseRuleSetLoader.loadFromResource(String)
and discard the rest of the list.Create a RuleSet from a RuleSet reference ID string. This is a convenience method which callsRuleSetReferenceId.parse(String)
, gets the first item in the List, and then callscreateRuleSet(RuleSetReferenceId)
. The currently configured ResourceLoader is used.- Parameters:
referenceString
- A comma separated list of RuleSet reference IDs.- Returns:
- A new RuleSet.
- Throws:
RuleSetNotFoundException
- if unable to find a resource.
-
createRuleSet
@Deprecated public RuleSet createRuleSet(RuleSetReferenceId ruleSetReferenceId) throws RuleSetNotFoundException
Deprecated.Will not be replacedCreate 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 rulesetdescription
- the descriptionfileName
- the filenameexcludePatterns
- list of exclude patterns, if any is not a valid regular expression, it will be ignoredincludePatterns
- list of include patterns, if any is not a valid regular expression, it will be ignoredrules
- the collection with the rules to add to the new ruleset- Returns:
- the new ruleset
-
createSingleRuleRuleSet
@Deprecated public RuleSet createSingleRuleRuleSet(Rule rule)
Deprecated.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 newRuleSetLoader
with the same config as this factory. This is a transitional API.
-
-