本文整理汇总了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();
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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);
}