当前位置: 首页>>代码示例>>Java>>正文


Java DomHelper.addChildElement方法代码示例

本文整理汇总了Java中io.fabric8.utils.DomHelper.addChildElement方法的典型用法代码示例。如果您正苦于以下问题:Java DomHelper.addChildElement方法的具体用法?Java DomHelper.addChildElement怎么用?Java DomHelper.addChildElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.fabric8.utils.DomHelper的用法示例。


在下文中一共展示了DomHelper.addChildElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addModuleNameIfMissing

import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected boolean addModuleNameIfMissing(Element modules, String moduleName) {
    NodeList childNodes = modules.getChildNodes();
    if (childNodes != null) {
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item instanceof Element) {
                Element property = (Element) item;
                if (moduleName.equals(property.getTextContent())) {
                    return false;
                }
            }
        }
    }
    modules.appendChild(modules.getOwnerDocument().createTextNode("\n      "));
    DomHelper.addChildElement(modules, "module", moduleName);
    return true;
}
 
开发者ID:funktionio,项目名称:funktion-connectors,代码行数:18,代码来源:ConnectorGenerator.java

示例2: getOrCreateFirstChild

import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected Element getOrCreateFirstChild(Element element, String elementName) {
    Element answer = DomHelper.firstChild(element, elementName);
    if (answer != null) {
        return answer;
    }
    return DomHelper.addChildElement(element, elementName);
}
 
开发者ID:funktionio,项目名称:funktion-connectors,代码行数:8,代码来源:ConnectorGenerator.java

示例3: ensureMavenDependency

import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected static boolean ensureMavenDependency(Document doc, String groupId, String artifactId, String scope) {
    Element dependences = DomHelper.firstChild(doc.getDocumentElement(), "dependencies");
    if (dependences == null) {
        dependences = DomHelper.addChildElement(doc.getDocumentElement(), "dependencies");
    }
    NodeList childNodes = dependences.getChildNodes();
    for (int i = 0, size = childNodes.getLength(); i < size; i++) {
        Node item = childNodes.item(i);
        if (item instanceof Element) {
            Element child = (Element) item;
            if (firstChildTextContent(child, "groupId", groupId) &&
                    firstChildTextContent(child, "artifactId", artifactId)) {
                return false;

            }

        }
    }
    dependences.appendChild(doc.createTextNode("\n    "));
    Element dependency = DomHelper.addChildElement(dependences, "dependency");
    dependency.appendChild(doc.createTextNode("\n      "));
    DomHelper.addChildElement(dependency, "groupId", groupId);
    dependency.appendChild(doc.createTextNode("\n      "));
    DomHelper.addChildElement(dependency, "artifactId", artifactId);
    dependency.appendChild(doc.createTextNode("\n      "));
    DomHelper.addChildElement(dependency, "scope", scope);
    dependency.appendChild(doc.createTextNode("\n    "));
    dependences.appendChild(doc.createTextNode("\n    "));
    return true;
}
 
开发者ID:fabric8io,项目名称:ipaas-quickstarts,代码行数:31,代码来源:ArchetypeTest.java

示例4: ensureMavenDependencyBOM

import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected static boolean ensureMavenDependencyBOM(Document doc, String groupId, String artifactId, String version) {
    Element dependencyManagement = DomHelper.firstChild(doc.getDocumentElement(), "dependencyManagement");
    if (dependencyManagement == null) {
        dependencyManagement = DomHelper.addChildElement(doc.getDocumentElement(), "dependencyManagement");
    }
    Element dependences = DomHelper.firstChild(dependencyManagement, "dependencies");
    if (dependences == null) {
        dependences = DomHelper.addChildElement(dependencyManagement, "dependencies");
    }

    NodeList childNodes = dependences.getChildNodes();
    for (int i = 0, size = childNodes.getLength(); i < size; i++) {
        Node item = childNodes.item(i);
        if (item instanceof Element) {
            Element child = (Element) item;
            if (firstChildTextContent(child, "groupId", groupId) &&
                    firstChildTextContent(child, "artifactId", artifactId)) {
                return false;

            }

        }
    }
    dependences.appendChild(doc.createTextNode("\n      "));
    Element dependency = DomHelper.addChildElement(dependences, "dependency");
    dependency.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(dependency, "groupId", groupId);
    dependency.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(dependency, "artifactId", artifactId);
    dependency.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(dependency, "version", version);
    dependency.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(dependency, "type", "pom");
    dependency.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(dependency, "scope", "import");
    dependency.appendChild(doc.createTextNode("\n      "));
    dependences.appendChild(doc.createTextNode("\n      "));
    return true;
}
 
开发者ID:fabric8io,项目名称:ipaas-quickstarts,代码行数:40,代码来源:ArchetypeTest.java

示例5: ensureFailsafePlugin

import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected boolean ensureFailsafePlugin(Document doc) {
    String artifactId = "maven-failsafe-plugin";
    Element build = DomHelper.firstChild(doc.getDocumentElement(), "build");
    if (build == null) {
        build = DomHelper.addChildElement(doc.getDocumentElement(), "build");
    }
    Element plugins = DomHelper.firstChild(build, "plugins");
    if (plugins == null) {
        plugins = DomHelper.addChildElement(build, "plugins");
    }

    NodeList childNodes = plugins.getChildNodes();
    for (int i = 0, size = childNodes.getLength(); i < size; i++) {
        Node item = childNodes.item(i);
        if (item instanceof Element) {
            Element child = (Element) item;
            if (firstChildTextContent(child, "artifactId", artifactId)) {
                return false;

            }

        }
    }
    plugins.appendChild(doc.createTextNode("\n      "));
    Element plugin = DomHelper.addChildElement(plugins, "plugin");
    plugin.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(plugin, "artifactId", artifactId);
    plugin.appendChild(doc.createTextNode("\n        "));
    DomHelper.addChildElement(plugin, "version", failsafeVersion);
    plugin.appendChild(doc.createTextNode("\n        "));
    Element configuration = DomHelper.addChildElement(plugin, "configuration");
    configuration.appendChild(doc.createTextNode("\n        "));
    Element includes = DomHelper.addChildElement(configuration, "includes");
    includes.appendChild(doc.createTextNode("\n          "));
    Element include = DomHelper.addChildElement(includes, "include", "**/*KT.*");
    includes.appendChild(doc.createTextNode("\n          "));
    configuration.appendChild(doc.createTextNode("\n        "));
    plugin.appendChild(doc.createTextNode("\n      "));
    plugins.appendChild(doc.createTextNode("\n      "));
    return true;
}
 
开发者ID:fabric8io,项目名称:ipaas-quickstarts,代码行数:42,代码来源:ArchetypeTest.java


注:本文中的io.fabric8.utils.DomHelper.addChildElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。