use of groovy.util.NodeList in project gradle by gradle.
the class AbstractClasspathEntry method writeAccessRules.
private void writeAccessRules(Node node) {
if (accessRules == null || accessRules.isEmpty()) {
return;
}
Node accessRulesNode;
NodeList accessRulesNodes = (NodeList) node.get("accessrules");
if (accessRulesNodes.size() == 0) {
accessRulesNode = node.appendNode("accessrules");
} else {
accessRulesNode = (Node) accessRulesNodes.get(0);
}
for (AccessRule rule : accessRules) {
Map<String, Object> attributes = Maps.newLinkedHashMap();
attributes.put("kind", rule.getKind());
attributes.put("pattern", rule.getPattern());
accessRulesNode.appendNode("accessrule", attributes);
}
}
use of groovy.util.NodeList in project gradle by gradle.
the class AbstractClasspathEntry method readEntryAttributes.
private Map<String, Object> readEntryAttributes(Node node) {
Map<String, Object> attributes = Maps.newLinkedHashMap();
NodeList attributesNodes = (NodeList) node.get("attributes");
for (Object attributesEntry : attributesNodes) {
NodeList attributeNodes = (NodeList) ((Node) attributesEntry).get("attribute");
for (Object attributeEntry : attributeNodes) {
Node attributeNode = (Node) attributeEntry;
attributes.put((String) attributeNode.attribute("name"), attributeNode.attribute("value"));
}
}
return attributes;
}
use of groovy.util.NodeList in project gradle by gradle.
the class Classpath method load.
@Override
protected void load(Node xml) {
for (Object e : (NodeList) xml.get("classpathentry")) {
Node entryNode = (Node) e;
Object kind = entryNode.attribute("kind");
if ("src".equals(kind)) {
String path = (String) entryNode.attribute("path");
entries.add(path.startsWith("/") ? new ProjectDependency(entryNode) : new SourceFolder(entryNode));
} else if ("var".equals(kind)) {
entries.add(new Variable(entryNode, fileReferenceFactory));
} else if ("con".equals(kind)) {
entries.add(new Container(entryNode));
} else if ("lib".equals(kind)) {
entries.add(new Library(entryNode, fileReferenceFactory));
} else if ("output".equals(kind)) {
entries.add(new Output(entryNode));
}
}
}
Aggregations