本文整理了Java中net.sourceforge.pmd.lang.ast.Node.hasDescendantMatchingXPath()
方法的一些代码示例,展示了Node.hasDescendantMatchingXPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.hasDescendantMatchingXPath()
方法的具体详情如下:
包路径:net.sourceforge.pmd.lang.ast.Node
类名称:Node
方法名:hasDescendantMatchingXPath
[英]Checks whether at least one descendant matches the xpath expression.
[中]检查是否至少有一个子代与xpath表达式匹配。
代码示例来源:origin: pmd/pmd
private boolean searchForAMatch(String matchType, Node node) {
String xpathQuery = "//ClassOrInterfaceDeclaration[(./ExtendsList/ClassOrInterfaceType[@Image = '" + matchType
+ "']) or (./ImplementsList/ClassOrInterfaceType[@Image = '" + matchType + "'])]";
return node.hasDescendantMatchingXPath(xpathQuery);
}
代码示例来源:origin: pmd/pmd
private void setSuppression(Rule rule, T node) {
String regex = rule.getProperty(Rule.VIOLATION_SUPPRESS_REGEX_DESCRIPTOR); // Regex
if (regex != null && description != null) {
if (Pattern.matches(regex, description)) {
suppressed = true;
}
}
if (!suppressed) { // XPath
String xpath = rule.getProperty(Rule.VIOLATION_SUPPRESS_XPATH_DESCRIPTOR);
if (xpath != null) {
suppressed = node.hasDescendantMatchingXPath(xpath);
}
}
}
代码示例来源:origin: net.sourceforge.pmd/pmd-java
private boolean searchForAMatch(String matchType, Node node) {
String xpathQuery = "//ClassOrInterfaceDeclaration[(./ExtendsList/ClassOrInterfaceType[@Image = '" + matchType
+ "']) or (./ImplementsList/ClassOrInterfaceType[@Image = '" + matchType + "'])]";
return node.hasDescendantMatchingXPath(xpathQuery);
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
private void setSuppression(Rule rule, T node) {
String regex = rule.getProperty(Rule.VIOLATION_SUPPRESS_REGEX_DESCRIPTOR); // Regex
if (regex != null && description != null) {
if (Pattern.matches(regex, description)) {
suppressed = true;
}
}
if (!suppressed) { // XPath
String xpath = rule.getProperty(Rule.VIOLATION_SUPPRESS_XPATH_DESCRIPTOR);
if (xpath != null) {
suppressed = node.hasDescendantMatchingXPath(xpath);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!