Package net.sourceforge.pmd.lang.rule
Class RuleTargetSelector
- java.lang.Object
-
- net.sourceforge.pmd.lang.rule.internal.TargetSelectorInternal
-
- net.sourceforge.pmd.lang.rule.RuleTargetSelector
-
public abstract class RuleTargetSelector extends net.sourceforge.pmd.lang.rule.internal.TargetSelectorInternal
A strategy for selecting nodes that will be targeted by a rule.- See Also:
Rule.getTargetSelector()
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RuleTargetSelector
forRootOnly()
Target only the root of the tree.static RuleTargetSelector
forTypes(Class<? extends Node> first, Class<? extends Node>... types)
Target nodes that are subtypes of any of the given classes.static RuleTargetSelector
forTypes(Collection<Class<? extends Node>> types)
Target nodes that are subtypes of any of the given classes.static RuleTargetSelector
forXPathNames(Collection<String> names)
Target nodes having one of the given XPath local name.boolean
isRuleChain()
-
-
-
Method Detail
-
forXPathNames
public static RuleTargetSelector forXPathNames(Collection<String> names)
Target nodes having one of the given XPath local name.- Parameters:
names
- XPath names- Returns:
- A selector
- Throws:
IllegalArgumentException
- If the argument is empty
-
forTypes
public static RuleTargetSelector forTypes(Collection<Class<? extends Node>> types)
Target nodes that are subtypes of any of the given classes.- Parameters:
types
- Node types- Returns:
- A selector
- Throws:
IllegalArgumentException
- If the argument is emptyNullPointerException
- If the argument is nullNullPointerException
- If any of the elements is null
-
forTypes
@SafeVarargs public static RuleTargetSelector forTypes(Class<? extends Node> first, Class<? extends Node>... types)
Target nodes that are subtypes of any of the given classes.- Parameters:
types
- Node types- Returns:
- A selector
- Throws:
NullPointerException
- if any of the arguments is null
-
forRootOnly
public static RuleTargetSelector forRootOnly()
Target only the root of the tree.
-
isRuleChain
@InternalApi public boolean isRuleChain()
-
-