|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.pmd.RuleSetReferenceId
public class RuleSetReferenceId
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.
String | RuleSet file name | Rule |
---|---|---|
rulesets/java/basic.xml | rulesets/java/basic.xml | all |
java-basic | rulesets/java/basic.xml | all |
50 | rulesets/releases/50.xml | all |
rulesets/java/basic.xml/EmptyCatchBlock | rulesets/java/basic.xml | EmptyCatchBlock |
EmptyCatchBlock | null | EmptyCatchBlock |
Constructor Summary | |
---|---|
RuleSetReferenceId(String id)
Construct a RuleSetReferenceId for the given single ID string. |
|
RuleSetReferenceId(String id,
RuleSetReferenceId externalRuleSetReferenceId)
Construct a RuleSetReferenceId for the given single ID string. |
Method Summary | |
---|---|
InputStream |
getInputStream(ClassLoader classLoader)
Try to load the RuleSet resource with the specified ClassLoader. |
String |
getRuleName()
Get the Rule name. |
String |
getRuleSetFileName()
Get the RuleSet file name. |
boolean |
isAllRules()
Is this a reference to all Rules in a RuleSet, or a single Rule? |
boolean |
isExternal()
Is this an external RuleSet reference? |
static List<RuleSetReferenceId> |
parse(String referenceString)
Parse a String comma separated list of RuleSet reference IDs into a List of RuleReferenceId instances. |
String |
toString()
Return the String form of this Rule reference. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RuleSetReferenceId(String id)
id
- The id string.
IllegalArgumentException
- If the ID contains a comma character.public RuleSetReferenceId(String id, RuleSetReferenceId externalRuleSetReferenceId)
id
- The id string.externalRuleSetReferenceId
- A RuleSetReferenceId to associate with
this new instance.
IllegalArgumentException
- If the ID contains a comma character.
IllegalArgumentException
- If external RuleSetReferenceId is not
external.
IllegalArgumentException
- If the ID is not Rule reference when
there is an external RuleSetReferenceId.Method Detail |
---|
public static List<RuleSetReferenceId> parse(String referenceString)
referenceString
- A comma separated list of RuleSet reference IDs.
public boolean isExternal()
true
if this is an external reference,
false
otherwise.public boolean isAllRules()
true
if this is a reference to all Rules,
false
otherwise.public String getRuleSetFileName()
null
otherwise.public String getRuleName()
public InputStream getInputStream(ClassLoader classLoader) throws RuleSetNotFoundException
classLoader
- The ClassLoader to use.
RuleSetNotFoundException
- if unable to find a resource.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |