Class RuleSetReferenceId

java.lang.Object

net.sourceforge.pmd.RuleSetReferenceId

public class RuleSetReferenceId
extends java.lang.Object

This class is used to parse a RuleSet reference value. Most commonly used for
specifying a RuleSet to process, or in a Rule 'ref' attribute value in the
RuleSet XML. The RuleSet reference can refer to either an external RuleSet or
the current RuleSet when used as a Rule 'ref' attribute value. An individual
Rule in the RuleSet can be indicated.
For an external RuleSet, referring to the entire RuleSet, the format is
ruleSetName, where the RuleSet name is either a resource file path to
a RuleSet that ends with '.xml', or a simple RuleSet name.
A simple RuleSet name, is one which contains no path separators, and either
contains a '-' or is entirely numeric release number. A simple name of the
form [language]-[name] is short for the full RuleSet name
rulesets/[language]/[name].xml. A numeric release simple name of
the form [release] is short for the full PMD Release RuleSet
name rulesets/releases/[release].xml.
For an external RuleSet, referring to a single Rule, the format is
ruleSetName/ruleName, where the RuleSet name is as described above. A
Rule with the ruleName should exist in this external RuleSet.
For the current RuleSet, the format is ruleName, where the Rule name
is not RuleSet name (i.e. contains no path separators, '-' or '.xml' in it,
and is not all numeric). A Rule with the ruleName should exist in the
current RuleSet.

RuleSetReferenceId

Construct a RuleSetReferenceId for the given single ID string. If an
external RuleSetReferenceId is given, the ID must refer to a non-external
Rule. The external RuleSetReferenceId will be responsible for producing
the InputStream containing the Rule.

Parameters:

id - The id string.

externalRuleSetReferenceId - A RuleSetReferenceId to associate with this new instance.

Throws:

java.lang.IllegalArgumentException - If the ID contains a comma character.

java.lang.IllegalArgumentException - If external RuleSetReferenceId is not external.

java.lang.IllegalArgumentException - If the ID is not Rule reference when there is an external
RuleSetReferenceId.

getRuleName

getInputStream

Try to load the RuleSet resource with the specified ResourceLoader. Multiple
attempts to get independent InputStream instances may be made, so
subclasses must ensure they support this behavior. Delegates to an
external RuleSetReferenceId if there is one associated with this
instance.