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


Java Result.getMessage方法代码示例

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


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

示例1: getMessage

import org.jboss.forge.addon.ui.result.Result; //导入方法依赖的package包/类
/**
 * Returns the result message handling composite results
 */
public static String getMessage(Result result) {
    if (result == null) {
        return null;
    } else if (result instanceof CompositeResult) {
        CompositeResult compositeResult = (CompositeResult) result;
        StringBuilder builder = new StringBuilder();
        List<Result> results = compositeResult.getResults();
        for (Result child : results) {
            String message = getMessage(child);
            if (message != null && message.trim().length() > 0) {
                if (builder.length() > 0) {
                    builder.append("\n");
                }
                builder.append(message);
            }
        }
        return builder.toString();

    }
    return result.getMessage();
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:25,代码来源:Results.java

示例2: getResultMessage

import org.jboss.forge.addon.ui.result.Result; //导入方法依赖的package包/类
protected static String getResultMessage(Result result) {
    if (result instanceof CompositeResult) {
        CompositeResult compositeResult = (CompositeResult) result;
        List<Result> results = compositeResult.getResults();
        StringBuilder buffer = new StringBuilder();
        for (Result childResult : results) {
            String childResultMessage = getResultMessage(childResult);
            if (Strings.isNotBlank(childResultMessage)) {
                if (buffer.length() > 0) {
                    buffer.append("\n");
                }
                buffer.append(childResultMessage);
            }
        }
        return buffer.toString();
    } else if (result != null) {
        return result.getMessage();
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:UICommands.java

示例3: getResultMessage

import org.jboss.forge.addon.ui.result.Result; //导入方法依赖的package包/类
public static String getResultMessage(Result result) {
    if (result instanceof CompositeResult) {
        CompositeResult compositeResult = (CompositeResult) result;
        List<Result> results = compositeResult.getResults();
        StringBuilder buffer = new StringBuilder();
        for (Result childResult : results) {
            String childResultMessage = getResultMessage(childResult);
            if (Strings.isNotBlank(childResultMessage)) {
                if (buffer.length() > 0) {
                    buffer.append("\n");
                }
                buffer.append(childResultMessage);
            }
        }
        return buffer.toString();
    } else if (result != null) {
        return result.getMessage();
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:CommandHelpers.java

示例4: testSomething

import org.jboss.forge.addon.ui.result.Result; //导入方法依赖的package包/类
@Test
public void testSomething() throws Exception {
    File tempDir = OperatingSystemUtils.createTempDir();
    try {
        Project project = projectFactory.createTempProject();
        Assert.assertNotNull("Should have created a project", project);

        CommandController command = testHarness.createCommandController(CamelSetupCommand.class, project.getRoot());
        command.initialize();
        command.setValueFor("kind", "camel-spring");

        Result result = command.execute();
        Assert.assertFalse("Should setup Camel in the project", result instanceof Failed);

        command = testHarness.createCommandController(CamelGetComponentsCommand.class, project.getRoot());
        command.initialize();

        result = command.execute();
        Assert.assertFalse("Should not fail", result instanceof Failed);

        String message = result.getMessage();
        System.out.println(message);
    } finally {
        tempDir.delete();
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:27,代码来源:NewComponentInstanceTest.java

示例5: getRoutesXml

import org.jboss.forge.addon.ui.result.Result; //导入方法依赖的package包/类
protected List<ContextDto> getRoutesXml(Project project) throws Exception {
    CommandController command = testHarness.createCommandController(CamelGetRoutesXmlCommand.class, project.getRoot());
    command.initialize();
    command.setValueFor("format", "JSON");

    Result result = command.execute();
    assertFalse("Should not fail", result instanceof Failed);

    String message = result.getMessage();

    System.out.println();
    System.out.println();
    System.out.println("JSON: " + message);
    System.out.println();

    List<ContextDto> answer = NodeDtos.parseContexts(message);
    System.out.println();
    System.out.println();
    List<NodeDto> nodeList = NodeDtos.toNodeList(answer);
    for (NodeDto node : nodeList) {
        System.out.println(node.getLabel());
    }
    System.out.println();
    return answer;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:26,代码来源:NewNodeXmlTest.java

示例6: assertValidAndExecutes

import org.jboss.forge.addon.ui.result.Result; //导入方法依赖的package包/类
protected static void assertValidAndExecutes(CommandController command) throws Exception {
    List<UIMessage> validate = command.validate();
    for (UIMessage uiMessage : validate) {
        System.out.println("Invalid value of input: " + uiMessage.getSource().getName() + " message: " + uiMessage.getDescription());
    }
    Result result = command.execute();
    String message = result.getMessage();
    assertFalse("Should not fail: " + message, result instanceof Failed);

    System.out.println(message);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:12,代码来源:NewNodeXmlTest.java


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