當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。