public class RuleSetReferenceId extends Object
'.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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.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()
Copyright © 2002-2017 PMD. All Rights Reserved.