本文整理汇总了Java中groovy.util.Node类的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于groovy.util包,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printNode
import groovy.util.Node; //导入依赖的package包/类
private void printNode(Node node, Writer writer) {
final PrintWriter printWriter = new PrintWriter(writer);
if (GUtil.isTrue(publicId)) {
printWriter.format("<!DOCTYPE %s PUBLIC \"%s\" \"%s\">%n", node.name(), publicId, systemId);
}
IndentPrinter indentPrinter = new IndentPrinter(printWriter, indentation) {
@Override
public void println() {
printWriter.println();
}
};
XmlNodePrinter nodePrinter = new XmlNodePrinter(indentPrinter);
nodePrinter.setPreserveWhitespace(true);
nodePrinter.print(node);
printWriter.flush();
}
示例2: addClasspathEntry
import groovy.util.Node; //导入依赖的package包/类
protected Node addClasspathEntry(Node node, Map<String, ?> attributes) {
Map<String, Object> allAttributes = Maps.newLinkedHashMap();
for (String key : attributes.keySet()) {
Object value = attributes.get(key);
if (value != null && !String.valueOf(value).isEmpty()) {
allAttributes.put(key, value);
}
}
allAttributes.put("kind", getKind());
allAttributes.put("path", path);
if (exported && !(this instanceof SourceFolder)) {
allAttributes.put("exported", true);
}
Node entryNode = node.appendNode("classpathentry", allAttributes);
writeAccessRules(entryNode);
writeEntryAttributes(entryNode);
return entryNode;
}
示例3: storeBytecodeLevels
import groovy.util.Node; //导入依赖的package包/类
private void storeBytecodeLevels() {
Node bytecodeLevelConfiguration = findOrCreateBytecodeLevelConfiguration();
bytecodeLevelConfiguration.attributes().put("target", bytecodeVersion.toString());
for (IdeaModule module : modules) {
List<Node> bytecodeLevelModules = getChildren(bytecodeLevelConfiguration, "module");
Node moduleNode = findFirstWithAttributeValue(bytecodeLevelModules, "name", module.getName());
JavaVersion moduleBytecodeVersionOverwrite = module.getTargetBytecodeVersion();
if (moduleBytecodeVersionOverwrite == null) {
if (moduleNode != null) {
bytecodeLevelConfiguration.remove(moduleNode);
}
} else {
if (moduleNode == null) {
moduleNode = bytecodeLevelConfiguration.appendNode("module");
moduleNode.attributes().put("name", module.getName());
}
moduleNode.attributes().put("target", moduleBytecodeVersionOverwrite.toString());
}
}
}
示例4: readSourceAndExcludeFolderFromXml
import groovy.util.Node; //导入依赖的package包/类
private void readSourceAndExcludeFolderFromXml() {
for (Node sourceFolder : findSourceFolder()) {
String url = (String) sourceFolder.attribute("url");
if ("false".equals(sourceFolder.attribute("isTestSource"))) {
sourceFolders.add(pathFactory.path(url));
} else {
testSourceFolders.add(pathFactory.path(url));
}
if ("true".equals(sourceFolder.attribute("generated"))) {
generatedSourceFolders.add(pathFactory.path(url));
}
}
for (Node excludeFolder : findExcludeFolder()) {
excludeFolders.add(pathFactory.path((String) excludeFolder.attribute("url")));
}
}
示例5: toXmlNode
import groovy.util.Node; //导入依赖的package包/类
@Override
public Node toXmlNode(Node parentModule, Object name) {
Node node = new Node(parentModule, name, path);
if (StringUtils.isNotEmpty(altDeployDescriptor)) {
new Node(parentModule, nodeNameFor("alt-dd", name), altDeployDescriptor);
}
return node;
}
示例6: toXmlNode
import groovy.util.Node; //导入依赖的package包/类
@Override
public Node toXmlNode(Node parentModule, Object name) {
Node web = new Node(parentModule, name);
new Node(web, nodeNameFor("web-uri", name), getPath());
new Node(web, nodeNameFor("context-root", name), contextRoot);
if (StringUtils.isNotEmpty(getAltDeployDescriptor())) {
return new Node(parentModule, nodeNameFor("alt-dd", name), getAltDeployDescriptor());
}
return null;
}
示例7: childNodeText
import groovy.util.Node; //导入依赖的package包/类
private static String childNodeText(Node root, String name) {
for (Node child : Cast.<List<Node>>uncheckedCast(root.children())) {
if (localNameOf(child).equals(name)) {
return child.text();
}
}
return null;
}
示例8: appendNode
import groovy.util.Node; //导入依赖的package包/类
@Override
public void appendNode(Node node) {
Map<String, Object> attributes = Maps.newHashMap();
attributes.put("deploy-path", deployPath);
attributes.put("source-path", sourcePath);
node.appendNode("wb-resource", attributes);
}
示例9: appendNode
import groovy.util.Node; //导入依赖的package包/类
public void appendNode(Node node) {
Map<String, Object> attributes = Maps.newHashMap();
attributes.put("facet", name);
if (type == FacetType.installed) {
attributes.put("version", version);
}
node.appendNode(type.name(), attributes);
}
示例10: store
import groovy.util.Node; //导入依赖的package包/类
@Override
protected void store(Node xml) {
removeConfigurableDataFromXml();
Node wbModuleNode = getWbModuleNode(xml);
wbModuleNode.attributes().put("deploy-name", deployName);
if (!isNullOrEmpty(contextPath)) {
new WbProperty("context-root", contextPath).appendNode(wbModuleNode);
}
for (WbModuleEntry wbModuleEntry : wbModuleEntries) {
wbModuleEntry.appendNode(wbModuleNode);
}
}
示例11: removeConfigurableDataFromXml
import groovy.util.Node; //导入依赖的package包/类
private void removeConfigurableDataFromXml() {
Node wbModuleNode = getWbModuleNode(getXml());
for (String elementName : Arrays.asList("property", "wb-resource", "dependent-module")) {
for (Node elementNode : XmlPersistableConfigurationObject.getChildren(wbModuleNode, elementName)) {
wbModuleNode.remove(elementNode);
}
}
}
示例12: appendNode
import groovy.util.Node; //导入依赖的package包/类
@Override
public void appendNode(Node node) {
Map<String, Object> attributes = Maps.newHashMap();
attributes.put("kind", getKind());
attributes.put("path", path);
node.appendNode("classpathentry", attributes);
}
示例13: load
import groovy.util.Node; //导入依赖的package包/类
@Override
protected void load(Node xml) {
Node nameNode = findFirstChildNamed(xml, "name");
name = nameNode != null ? nameNode.text() : "";
Node commentNode = findFirstChildNamed(xml, "comment");
comment = commentNode != null ? commentNode.text() : "";
readReferencedProjects();
readNatures();
readBuildCommands();
readLinkedResources();
}
示例14: readBuildCommands
import groovy.util.Node; //导入依赖的package包/类
private void readBuildCommands() {
for (Node commandNode : getChildren(findFirstChildNamed(getXml(), "buildSpec"), "buildCommand")) {
String name = findFirstChildNamed(commandNode, "name").text();
Map<String, String> arguments = Maps.newHashMap();
for (Node dictionaryNode : getChildren(findFirstChildNamed(commandNode, "arguments"), "dictionary")) {
String key = findFirstChildNamed(dictionaryNode, "key").text();
String value = findFirstChildNamed(dictionaryNode, "value").text();
arguments.put(key, value);
}
buildCommands.add(new BuildCommand(name, arguments));
}
}
示例15: store
import groovy.util.Node; //导入依赖的package包/类
@Override
protected void store(Node xml) {
for (String childNodeName : Arrays.asList("name", "comment", "projects", "natures", "buildSpec", "linkedResources")) {
Node childNode = findFirstChildNamed(xml, childNodeName);
if (childNode != null) {
xml.remove(childNode);
}
}
xml.appendNode("name", nullToEmpty(name));
xml.appendNode("comment", nullToEmpty(comment));
addReferencedProjectsToXml();
addNaturesToXml();
addBuildSpecToXml();
addLinkedResourcesToXml();
}