MCPcopy Index your code
hub / github.com/apache/groovy / getByName

Method getByName

src/main/java/groovy/util/Node.java:556–571  ·  view source on GitHub ↗

Provides lookup of elements by name. @param name the name of interest @return the nodes matching name

(String name)

Source from the content-addressed store, hash-verified

554 * @return the nodes matching name
555 */
556 private NodeList getByName(String name) {
557 NodeList answer = new NodeList();
558 for (Object child : children()) {
559 if (child instanceof Node childNode) {
560 Object childNodeName = childNode.name();
561 if (childNodeName instanceof QName qn) {
562 if (qn.matches(name)) {
563 answer.add(childNode);
564 }
565 } else if (name.equals(childNodeName)) {
566 answer.add(childNode);
567 }
568 }
569 }
570 return answer;
571 }
572
573 /**
574 * Provides a collection of all the nodes in the tree

Callers 1

getMethod · 0.95

Calls 5

childrenMethod · 0.95
nameMethod · 0.65
matchesMethod · 0.65
addMethod · 0.65
equalsMethod · 0.65

Tested by

no test coverage detected