public class RuleSetReferenceId
extends java.lang.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 | Description |
---|---|
RuleSetReferenceId(java.lang.String id) |
Construct a RuleSetReferenceId for the given single ID string.
|
RuleSetReferenceId(java.lang.String id,
RuleSetReferenceId externalRuleSetReferenceId) |
Construct a RuleSetReferenceId for the given single ID string.
|
Modifier and Type | Method | Description |
---|---|---|
java.io.InputStream |
getInputStream(ResourceLoader rl) |
Try to load the RuleSet resource with the specified ResourceLoader.
|
java.lang.String |
getRuleName() |
Get the Rule name.
|
java.lang.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 java.util.List<RuleSetReferenceId> |
parse(java.lang.String referenceString) |
Parse a String comma separated list of RuleSet reference IDs into a List
of RuleReferenceId instances.
|
java.lang.String |
toString() |
Return the String form of this Rule reference.
|
public RuleSetReferenceId(java.lang.String id)
id
- The id string.java.lang.IllegalArgumentException
- If the ID contains a comma character.public RuleSetReferenceId(java.lang.String id, RuleSetReferenceId externalRuleSetReferenceId)
id
- The id string.externalRuleSetReferenceId
- A RuleSetReferenceId to associate with this new instance.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.public static java.util.List<RuleSetReferenceId> parse(java.lang.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 java.lang.String getRuleSetFileName()
null
otherwise.public java.lang.String getRuleName()
public java.io.InputStream getInputStream(ResourceLoader rl) throws RuleSetNotFoundException
rl
- The ResourceLoader
to use.RuleSetNotFoundException
- if unable to find a resource.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2002–2018 PMD. All rights reserved.