本文整理了Java中io.fabric8.common.util.Strings.join()
方法的一些代码示例,展示了Strings.join()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.join()
方法的具体详情如下:
包路径:io.fabric8.common.util.Strings
类名称:Strings
方法名:join
[英]joins a collection of objects together as a String using a separator
[中]使用分隔符将对象集合作为字符串连接在一起
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void setJmxDomains(List<String> jmxDomains) {
String text = Strings.join(jmxDomains, "\n");
setAttribute(DataStore.ContainerAttribute.Domains, text);
}
代码示例来源:origin: jboss-fuse/fabric8
protected Map<String, String> createChildEnvironmentVariables() {
Map<String, String> answer = new HashMap<>();
Map<String, String> current = System.getenv();
for (String variable : allowInheritedEnvironmentVariables) {
String value = current.get(variable);
if (Strings.isNotBlank(value)) {
answer.put(variable, value);
}
}
if (environmentVariables != null) {
answer.putAll(environmentVariables);
}
answer.put(EnvironmentVariables.FABRIC8_PROFILES, join(getProfiles(), ","));
if (answer.get(JAVA_OPTS) == null) {
answer.put(JAVA_OPTS, DEFAULT_JAVA_OPTS);
}
return answer;
}
代码示例来源:origin: jboss-fuse/fabric8
protected String executeCommand(File workDir, String... commands) throws IOException {
String errors = null;
String answer = null;
String message = join(asList(commands), " ");
try {
System.out.println("Executing " + message);
ProcessBuilder builder = new ProcessBuilder().command(commands).directory(workDir);
Map<String, String> env = builder.environment();
Map<String, String> envVars = createChildEnvironmentVariables();
env.putAll(envVars);
logEnvironmentVariables(env);
Process process = builder.start();
answer = readProcessOutput(process.getInputStream(), message);
errors = processErrors(process.getErrorStream(), message);
int status = process.waitFor();
assertEquals("Command " + message + "; " + answer + " Status", 0, status);
} catch (Exception e) {
fail("Failed to execute command " +
message +
": " + e);
}
errors = errors.trim();
if (errors.length() > 0) {
fail("Command: " + message + " got errors: " + errors);
}
return answer;
}
代码示例来源:origin: io.fabric8/fabric-commands
protected void printProfiles(ProfileService profileService, List<Profile> profiles, PrintStream out) {
TablePrinter table = new TablePrinter();
table.columns("id", "# containers", "parents");
for (Profile profile : profiles) {
String versionId = profile.getVersion();
String profileId = profile.getId();
// skip profiles that do not exists (they may have been deleted)
if (profileService.hasProfile(versionId, profileId) && (hidden || !profile.isHidden())) {
int active = fabricService.getAssociatedContainers(versionId, profileId).length;
String parents = Strings.join(profile.getParentIds(), " ");
table.row(profileId, activeContainerCountText(active), parents);
}
}
table.print();
}
内容来源于网络,如有侵权,请联系作者删除!