public class RuleSetFactory
extends java.lang.Object
RulePriority.LOW
priority,
with Rule deprecation warnings off.
By default, the ruleset compatibility filter is active, too.
See RuleSetFactoryCompatibility
.Constructor and Description |
---|
RuleSetFactory() |
RuleSetFactory(java.lang.ClassLoader classLoader,
RulePriority minimumPriority,
boolean warnDeprecated,
boolean enableCompatibility)
Deprecated.
Use
RuleSetFactory(ResourceLoader, RulePriority, boolean, boolean) with
ResourceLoader instead of a ClassLoader . |
RuleSetFactory(ResourceLoader resourceLoader,
RulePriority minimumPriority,
boolean warnDeprecated,
boolean enableCompatibility) |
RuleSetFactory(RuleSetFactory factory,
boolean warnDeprecated)
Constructor copying all configuration from another factory.
|
Modifier and Type | Method and Description |
---|---|
RuleSet |
createNewRuleSet(java.lang.String name,
java.lang.String description,
java.lang.String fileName,
java.util.Collection<java.lang.String> excludePatterns,
java.util.Collection<java.lang.String> includePatterns,
java.util.Collection<Rule> rules)
Creates a new ruleset with the given metadata such as name, description,
fileName, exclude/include patterns are used.
|
RuleSet |
createRuleSet(RuleSetReferenceId ruleSetReferenceId)
Create a RuleSet from a RuleSetReferenceId.
|
RuleSet |
createRuleSet(java.lang.String referenceString)
Create a RuleSet from a RuleSet reference ID string.
|
RuleSet |
createRuleSetCopy(RuleSet original)
Creates a copy of the given ruleset.
|
RuleSets |
createRuleSets(java.util.List<RuleSetReferenceId> ruleSetReferenceIds)
Create a RuleSets from a list of RuleSetReferenceIds.
|
RuleSets |
createRuleSets(java.lang.String referenceString)
Create a RuleSets from a comma separated list of RuleSet reference IDs.
|
RuleSet |
createSingleRuleRuleSet(Rule rule)
Creates a new RuleSet for a single rule
|
java.util.Iterator<RuleSet> |
getRegisteredRuleSets()
Returns an Iterator of RuleSet objects loaded from descriptions from the
"categories.properties" resource for each Language with Rule support.
|
public RuleSetFactory()
@Deprecated public RuleSetFactory(java.lang.ClassLoader classLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
RuleSetFactory(ResourceLoader, RulePriority, boolean, boolean)
with
ResourceLoader
instead of a ClassLoader
.public RuleSetFactory(ResourceLoader resourceLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
public RuleSetFactory(RuleSetFactory factory, boolean warnDeprecated)
factory
- The factory whose configuration to copy.warnDeprecated
- Whether deprecation warnings are to be produced by this
factory.public java.util.Iterator<RuleSet> getRegisteredRuleSets() throws RuleSetNotFoundException
RuleSetNotFoundException
- if the ruleset file could not be foundpublic RuleSets createRuleSets(java.lang.String referenceString) throws RuleSetNotFoundException
RuleSetReferenceId.parse(String)
, and then calls
createRuleSets(List)
. The currently configured ResourceLoader is
used.referenceString
- A comma separated list of RuleSet reference IDs.RuleSetNotFoundException
- if unable to find a resource.public RuleSets createRuleSets(java.util.List<RuleSetReferenceId> ruleSetReferenceIds) throws RuleSetNotFoundException
ruleSetReferenceIds
- The List of RuleSetReferenceId of the RuleSets to create.RuleSetNotFoundException
- if unable to find a resource.public RuleSet createRuleSet(java.lang.String referenceString) throws RuleSetNotFoundException
RuleSetReferenceId.parse(String)
,
gets the first item in the List, and then calls
createRuleSet(RuleSetReferenceId)
. The currently configured
ResourceLoader is used.referenceString
- A comma separated list of RuleSet reference IDs.RuleSetNotFoundException
- if unable to find a resource.public RuleSet createRuleSet(RuleSetReferenceId ruleSetReferenceId) throws RuleSetNotFoundException
ruleSetReferenceId
- The RuleSetReferenceId of the RuleSet to create.RuleSetNotFoundException
- if unable to find a resource.public RuleSet createRuleSetCopy(RuleSet original)
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.
original
- the original rule set to copy frompublic RuleSet createNewRuleSet(java.lang.String name, java.lang.String description, java.lang.String fileName, java.util.Collection<java.lang.String> excludePatterns, java.util.Collection<java.lang.String> includePatterns, java.util.Collection<Rule> rules)
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.
name
- the name of the rulesetdescription
- the descriptionfileName
- the filenameexcludePatterns
- list of exclude patternsincludePatterns
- list of include patternsrules
- the collection with the rules to add to the new rulesetCopyright © 2002–2018 PMD. All rights reserved.