net.sourceforge.pmd
Class RuleSetFactory

java.lang.Object
  extended by net.sourceforge.pmd.RuleSetFactory

public class RuleSetFactory
extends java.lang.Object

RuleSetFactory is responsible for creating RuleSet instances from XML content.


Constructor Summary
RuleSetFactory()
           
 
Method Summary
 RuleSet createRuleSet(java.io.InputStream inputStream)
          Create a RuleSet from an InputStream.
 RuleSet createRuleSet(java.io.InputStream inputStream, java.lang.ClassLoader classLoader)
          Create a RuleSet from an InputStream with a specified ClassLoader.
 RuleSet createRuleSet(java.lang.String name, java.lang.ClassLoader classLoader)
          Deprecated. Use createRuleSets instead, because this method puts all rules in one single RuleSet object, and thus removes name and language of the originating rule set files.
 RuleSets createRuleSets(java.lang.String ruleSetFileNames)
          Create a RuleSets from a list of names.
 RuleSets createRuleSets(java.lang.String ruleSetFileNames, java.lang.ClassLoader classLoader)
          Create a RuleSets from a list of names with a specified ClassLoader.
 RuleSet createSingleRuleSet(java.lang.String ruleSetFileName)
          Create a RuleSet from a file name resource.
 java.util.Iterator<RuleSet> getRegisteredRuleSets()
          Returns an Iterator of RuleSet objects loaded from descriptions from the "rulesets.properties" resource.
 void setMinimumPriority(int minPriority)
          Set the minimum rule priority threshold for all Rules which are loaded from RuleSets via reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleSetFactory

public RuleSetFactory()
Method Detail

setMinimumPriority

public void setMinimumPriority(int minPriority)
Set the minimum rule priority threshold for all Rules which are loaded from RuleSets via reference.

Parameters:
minPriority - The minimum priority.

getRegisteredRuleSets

public java.util.Iterator<RuleSet> getRegisteredRuleSets()
                                                  throws RuleSetNotFoundException
Returns an Iterator of RuleSet objects loaded from descriptions from the "rulesets.properties" resource.

Returns:
An Iterator of RuleSet objects.
Throws:
RuleSetNotFoundException

createRuleSets

public RuleSets createRuleSets(java.lang.String ruleSetFileNames)
                        throws RuleSetNotFoundException
Create a RuleSets from a list of names. The ClassLoader of the RuleSetFactory class is used.

Parameters:
ruleSetFileNames - A comma-separated list of rule set files.
Returns:
The new RuleSets.
Throws:
RuleSetNotFoundException - if unable to find a resource.

createRuleSets

public RuleSets createRuleSets(java.lang.String ruleSetFileNames,
                               java.lang.ClassLoader classLoader)
                        throws RuleSetNotFoundException
Create a RuleSets from a list of names with a specified ClassLoader.

Parameters:
ruleSetFileNames - A comma-separated list of rule set files.
classLoader - The ClassLoader to load Classes and resources.
Returns:
The new RuleSets.
Throws:
RuleSetNotFoundException - if unable to find a resource.

createRuleSet

public RuleSet createRuleSet(java.lang.String name,
                             java.lang.ClassLoader classLoader)
                      throws RuleSetNotFoundException
Deprecated. Use createRuleSets instead, because this method puts all rules in one single RuleSet object, and thus removes name and language of the originating rule set files.

Create a ruleset from a name or from a list of names

Parameters:
name - name of rule set file loaded as a resource
classLoader - the classloader used to load the ruleset and subsequent rules
Returns:
the new ruleset
Throws:
RuleSetNotFoundException

createSingleRuleSet

public RuleSet createSingleRuleSet(java.lang.String ruleSetFileName)
                            throws RuleSetNotFoundException
Create a RuleSet from a file name resource. The ClassLoader of the RuleSetFactory class is used.

Parameters:
ruleSetFileName - The name of rule set file loaded as a resource.
Returns:
A new RuleSet.
Throws:
RuleSetNotFoundException - if unable to find a resource.

createRuleSet

public RuleSet createRuleSet(java.io.InputStream inputStream)
Create a RuleSet from an InputStream. The ClassLoader of the RuleSetFactory class is used.

Parameters:
inputStream - InputStream containing the RuleSet XML configuration.
Returns:
A new RuleSet.

createRuleSet

public RuleSet createRuleSet(java.io.InputStream inputStream,
                             java.lang.ClassLoader classLoader)
Create a RuleSet from an InputStream with a specified ClassLoader.

Parameters:
inputStream - InputStream containing the RuleSet XML configuration.
classLoader - The ClassLoader to load Classes and resources.
Returns:
A new RuleSet.


Copyright © 2002-2011 InfoEther. All Rights Reserved.