本文整理了Java中org.jboss.shrinkwrap.descriptor.spi.node.Node.getChildren()
方法的一些代码示例,展示了Node.getChildren()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getChildren()
方法的具体详情如下:
包路径:org.jboss.shrinkwrap.descriptor.spi.node.Node
类名称:Node
方法名:getChildren
[英]Get all the defined children for this node in an immutable view.
[中]在不可变视图中获取此节点的所有已定义子级。
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
protected List<Node> findMatch(Node start, List<Pattern> patterns) {
// Get the next pattern in sequence
final Pattern pattern = patterns.get(0);
if (!pattern.matches(start)) {
return Collections.emptyList();
}
// Hold the matched Nodes
final List<Node> matchedNodes = new ArrayList<Node>();
if (patterns.size() == 1) {
matchedNodes.add(start);
return matchedNodes;
}
for (final Node child : start.getChildren()) {
// Only use patterns that haven't already matched
final List<Pattern> remainingPatterns = patterns.subList(1, patterns.size());
// Recursion point
matchedNodes.addAll(findMatch(child, remainingPatterns));
}
return matchedNodes;
}
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
protected List<Node> findMatch(Node start, List<Pattern> patterns) {
// Get the next pattern in sequence
final Pattern pattern = patterns.get(0);
if (!pattern.matches(start)) {
return Collections.emptyList();
}
// Hold the matched Nodes
final List<Node> matchedNodes = new ArrayList<Node>();
if (patterns.size() == 1) {
matchedNodes.add(start);
return matchedNodes;
}
for (final Node child : start.getChildren()) {
// Only use patterns that haven't already matched
final List<Pattern> remainingPatterns = patterns.subList(1, patterns.size());
// Recursion point
matchedNodes.addAll(findMatch(child, remainingPatterns));
}
return matchedNodes;
}
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
private List<Node> findMatch(final Node start, final List<Pattern> patternSequence,
final List<Pattern> entirePatternSequence) {
// Hold the matched Nodes
final List<Node> matchedNodes = new ArrayList<Node>();
// Get the next pattern in sequence
final Pattern pattern = patternSequence.get(0);
// See if we've got a match
if (pattern.matches(start)) {
// If no more patterns to check, we're at the end of the line; just add this Node
if (patternSequence.size() == 1) {
matchedNodes.add(start);
} else {
for (final Node child : start.getChildren()) {
// Only use patterns that haven't already matched
final List<Pattern> remainingPatterns = patternSequence.subList(1, patternSequence.size());
// Recursion point
matchedNodes.addAll(findMatch(child, remainingPatterns, entirePatternSequence));
}
}
}
// Apply whole pattern sequence starting from the subtrees
// created by node's children
for (final Node child : start.getChildren()) {
matchedNodes.addAll(findMatch(child, entirePatternSequence, entirePatternSequence));
}
return matchedNodes;
}
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
private List<Node> findMatch(final Node start, final List<Pattern> patternSequence,
final List<Pattern> entirePatternSequence) {
// Hold the matched Nodes
final List<Node> matchedNodes = new ArrayList<Node>();
// Get the next pattern in sequence
final Pattern pattern = patternSequence.get(0);
// See if we've got a match
if (pattern.matches(start)) {
// If no more patterns to check, we're at the end of the line; just add this Node
if (patternSequence.size() == 1) {
matchedNodes.add(start);
} else {
for (final Node child : start.getChildren()) {
// Only use patterns that haven't already matched
final List<Pattern> remainingPatterns = patternSequence.subList(1, patternSequence.size());
// Recursion point
matchedNodes.addAll(findMatch(child, remainingPatterns, entirePatternSequence));
}
}
}
// Apply whole pattern sequence starting from the subtrees
// created by node's children
for (final Node child : start.getChildren()) {
matchedNodes.addAll(findMatch(child, entirePatternSequence, entirePatternSequence));
}
return matchedNodes;
}
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
for (Node sourceChild : source.getChildren()) {
writeRecursive(targetChild, sourceChild);
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
for (Node sourceChild : source.getChildren()) {
writeRecursive(targetChild, sourceChild);
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
/**
* Copies <code>this</code> reference to the specified {@link Node}
* @param copyTarget
* @return
*/
private Node deepCopy(final Node copyTarget){
// Precondition checks
assert copyTarget != null : "Node to copy information into must be specified";
// Set attributes
final Map<String, String> attributes = this.getAttributes();
final Set<String> attributeKeys = attributes.keySet();
for (final String key : attributeKeys) {
final String value = attributes.get(key);
copyTarget.attribute(key, value);
}
// Set text
copyTarget.text(this.getText());
// Set children
final List<Node> children = this.getChildren();
for (final Node child : children) {
final Node newChild = copyTarget.createChild(child.getName());
// Recurse in
child.deepCopy(newChild);
}
// Return
return this;
}
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
/**
* Copies <code>this</code> reference to the specified {@link Node}
* @param copyTarget
* @return
*/
private Node deepCopy(final Node copyTarget){
// Precondition checks
assert copyTarget != null : "Node to copy information into must be specified";
// Set attributes
final Map<String, String> attributes = this.getAttributes();
final Set<String> attributeKeys = attributes.keySet();
for (final String key : attributeKeys) {
final String value = attributes.get(key);
copyTarget.attribute(key, value);
}
// Set text
copyTarget.text(this.getText());
// Set children
final List<Node> children = this.getChildren();
for (final Node child : children) {
final Node newChild = copyTarget.createChild(child.getName());
// Recurse in
child.deepCopy(newChild);
}
// Return
return this;
}
内容来源于网络,如有侵权,请联系作者删除!