private static List getParentList(Node parent) { Object parentValue = parent.value(); List parentList; if (parentValue instanceof List) { parentList = (List) parentValue; } else { parentList = new NodeList(); parentList.add(parentValue); parent.setValue(parentList); } return parentList; }
private List getParentList(Node parent) { Object parentValue = parent.value(); List parentList; if (parentValue instanceof List) { parentList = (List) parentValue; } else { parentList = new NodeList(); parentList.add(parentValue); parent.setValue(parentList); } return parentList; }
private List getParentList(Node parent) { Object parentValue = parent.value(); List parentList; if (parentValue instanceof List) { parentList = (List) parentValue; } else { parentList = new NodeList(); parentList.add(parentValue); parent.setValue(parentList); } return parentList; }
private List getParentList(Node parent) { Object parentValue = parent.value(); List parentList; if (parentValue instanceof List) { parentList = (List) parentValue; } else { parentList = new NodeList(); parentList.add(parentValue); parent.setValue(parentList); } return parentList; }
private List getParentList(Node parent) { Object parentValue = parent.value(); List parentList; if (parentValue instanceof List) { parentList = (List) parentValue; } else { parentList = new NodeList(); parentList.add(parentValue); parent.setValue(parentList); } return parentList; }
new Node(metadata, "groupId").setValue(coord.group); new Node(metadata, "artifactId").setValue(coord.artifactId); new Node(metadata, "version").setValue(allVersions.get(allVersions.size() - 1)); Node versioning = new Node(metadata, "versioning"); Node versions = new Node(versioning, "versions"); for (Version version : allVersions) { new Node(versions, "version").setValue(version.toString()); new Node(versioning, "lastUpdated").setValue(System.currentTimeMillis());
/** * Apply unique ids for all nodes. * Remove '_' prefix from nodes (workaround for clashes with method names). * * @param root current node * @param topId id to apply */ private static void prepareTree(Node root, String topId) { root.attributes().put(NID_ATTR, topId); String name = (String) root.name(); if (name.startsWith("_")) { Node replace = new Node(null, name.substring(1)); replace.setValue(root.value()); root.replaceNode(replace); } int pos = 0; if (!isLeaf(root)) { List<Node> list = root.children(); for (int i = 0, size = list.size(); i < size; i++) { pos += 1; prepareTree(list.get(i), topId + "_" + pos); } } }
private void addManagedDependency(Node managedDependencies, Dependency managedDependency, String classifier) { Node dependencyNode = appendDependencyNode(managedDependencies, managedDependency.getCoordinates(), managedDependency.getScope(), managedDependency.getType()); if (!managedDependency.getExclusions().isEmpty()) { Node exclusionsNode = dependencyNode.appendNode(NODE_NAME_EXCLUSIONS); for (String exclusion : managedDependency.getExclusions()) { String[] exclusionComponents = exclusion.split(":"); Node exclusionNode = exclusionsNode.appendNode(NODE_NAME_EXCLUSION); exclusionNode.appendNode(NODE_NAME_GROUP_ID, exclusionComponents[0]); exclusionNode.appendNode(NODE_NAME_ARTIFACT_ID, exclusionComponents[1]); } } if (classifier != null) { Node classifierNode = dependencyNode.appendNode(NODE_NAME_CLASSIFIER); classifierNode.setValue(classifier); } }