本文整理了Java中com.github.javaparser.ast.Node.getChildrenNodes()
方法的一些代码示例,展示了Node.getChildrenNodes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getChildrenNodes()
方法的具体详情如下:
包路径:com.github.javaparser.ast.Node
类名称:Node
方法名:getChildrenNodes
暂无
代码示例来源:origin: stackoverflow.com
public Set<Node> getActiveChildrenNodes(Node n){
Set<Node> result = new HashSet();
for(Node cn : n.getChildrenNodes()){
if(cn.isActive)
result.add(cn);
}
return result;
}
代码示例来源:origin: stackoverflow.com
void process(Node node){
// Do something with the node
for (Node child : node.getChildrenNodes()){
process(child);
}
}
代码示例来源:origin: org.jooby/jooby-spec
private List<MethodCallExpr> dump(final Node n) {
List<MethodCallExpr> dump = new ArrayList<>();
if (n instanceof MethodCallExpr) {
dump.add((MethodCallExpr) n);
}
List<Node> children = n.getChildrenNodes();
for (Node c : children) {
dump.addAll(dump(c));
}
return dump;
}
代码示例来源:origin: org.wisdom-framework/wisdom-source-model
/**
* <p>
* Extract the String value for each child of the <code>node</code> or the node itself if it does not
* have children.
* </p>
*
* <p>It removes the {@literal "}.</p>
* @param node The java node which children or value to convert into a list of string.
* @return list of the node children string value or singleton list with the value of the node if no children.
*/
public static Set<String> asStringSet(Node node){
if(node.getChildrenNodes() == null || node.getChildrenNodes().isEmpty()){
return singleton(asString(node));
}
Set<String> list = new LinkedHashSet<>(node.getChildrenNodes().size());
for(Node child: node.getChildrenNodes()){
list.add(asString(child));
}
return list;
}
代码示例来源:origin: stackoverflow.com
void processNode(Node node) {
if (node instanceof TypeDeclaration) {
// do something with this type declaration
} else if (node instanceof MethodDeclaration) {
// do something with this method declaration
} else if (node instanceof FieldDeclaration) {
// do something with this field declaration
}
for (Node child : node.getChildrenNodes()){
processNode(child);
}
}
...
CompilationUnit cu = JavaParser.parse(sourceFile);
processNode(node);
...
内容来源于网络,如有侵权,请联系作者删除!