List of usage examples for org.apache.commons.lang StringUtils join
public static String join(Collection<?> collection, String separator)
Joins the elements of the provided Collection
into a single String containing the provided elements.
From source file:name.martingeisse.ecobuild.moduletool.c.DevHostApplicationTool.java
@Override protected void onModuleOutdated(IModuleToolContext context) throws IOException { File moduleSourceFolder = context.getModuleSourceFolder(); File moduleBuildFolder = context.getModuleBuildFolder(); AbstractLogger logger = context.getLogger(); String executableName = getOutputFileName(context); String sourceFiles = StringUtils.join(moduleSourceFolder.list(new SuffixFileFilter(".c")), ' '); String outputFileName = moduleBuildFolder.getCanonicalPath() + "/" + executableName; String command = "$" + Constants.GCC_PATH + "$ -Wall -m32 -o $" + outputFileName + "$ " + sourceFiles; new GccInvocation(context, moduleSourceFolder, command, logger).invoke(); File outputFile = new File(moduleBuildFolder, executableName); if (!outputFile.setExecutable(true)) { context.getLogger().logError("could not make DevApplication target executable: " + outputFile); }// ww w .j a v a 2s . c om }
From source file:com.github.hexocraft.chestpreview.command.CpCommandHelp.java
/** * @param plugin The plugin that this object belong to. *///from ww w .j a va 2 s . com public CpCommandHelp(ChestPreviewPlugin plugin) { super(plugin); this.setDescription(StringUtils.join(plugin.messages.cHelp, "\n")); this.setPermission(Permissions.ADMIN.toString()); this.setDisplayInlineDescription(true); this.removeArgument("page"); }
From source file:io.viewserver.operators.table.TableKeyDefinition.java
public String getValue(TableKey tableKey) { return StringUtils.join(tableKey.getValues(), SEPARATOR); }
From source file:com.dsh105.echopet.compat.api.plugin.ModuleLogger.java
public ModuleLogger(Logger parent, String... modulePath) { super(StringUtils.join(modulePath, "."), null); this.setParent(parent); this.setLevel(Level.ALL); this.modulePath = modulePath; StringBuilder builder = new StringBuilder(); for (String module : modulePath) { builder.append("[").append(module).append("] "); }//w w w . j a v a2s .c o m this.prefix = builder.toString(); }
From source file:com.microsoft.azure.shortcuts.services.samples.VirtualMachinesSample.java
public static void test(Azure azure) throws Exception { final String timeStamp = String.valueOf(System.currentTimeMillis()).substring(5); // List virtual machines List<String> vmNames = azure.virtualMachines().names(); System.out.println("Virtual machines:\n\t" + StringUtils.join(vmNames, ",\n\t")); // Create a Linux VM in a new service final String vmName = "vm" + timeStamp; System.out.println(String.format("Creating virtual machine named '%s'...", vmName)); azure.virtualMachines().define(vmName).withRegion("West US").withSize("Small").withAdminUsername("marcins") .withAdminPassword("Abcd.1234") .withLinuxImage(// w w w. jav a 2 s. co m "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_5_LTS-amd64-server-20150413-en-us-30GB") .withHostName(vmName).withTcpEndpoint(22).create(); // Add a Windows VM to the same service deployment final String vmNameWin = "wm" + timeStamp; azure.virtualMachines().define(vmNameWin).withExistingCloudService(vmName).withSize("Small") .withAdminUsername("marcins").withAdminPassword("Abcd.1234") .withWindowsImage("3a50f22b388a4ff7ab41029918570fa6__Windows-Server-2012-Essentials-20140715-enus") .withTcpEndpoint(3389).create(); // Create a new network final String network = "net" + timeStamp; System.out.println(String.format("Creating virtual network named '%s'...", network)); azure.networks().define(network).withRegion("West US").withAddressSpace("10.0.0.0/28") .withSubnet("Foo", "10.0.0.0/29").withSubnet("Bar", "10.0.0.8/29").create(); // Create a Linux VM in that network final String vmName2 = "vl" + timeStamp; System.out.println(String.format("Creating virtual machine named '%s'...", vmName2)); final String cloudService2 = "cs" + timeStamp; azure.virtualMachines().define(vmName2).withExistingNetwork(network).withSize("Small") .withAdminUsername("marcins").withAdminPassword("Abcd.1234") .withLinuxImage( "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_5_LTS-amd64-server-20150413-en-us-30GB") .withTcpEndpoint(22).withSubnet("Foo").create(); // List virtual machines vmNames = azure.virtualMachines().names(); System.out.println("Virtual machines: " + StringUtils.join(vmNames, ", ")); // Get information about the created Linux vm VirtualMachine vm = azure.virtualMachines(vmName); printVM(vm); // Get information about the created Windows vm vm = azure.virtualMachines(vmName + "." + vmNameWin); printVM(vm); // Get information about the second Linux VM vm = azure.virtualMachines(cloudService2 + "." + vmName2); printVM(vm); }
From source file:com.alibaba.cobar.manager.dao.delegate.CobarAdapterKey.java
@Override public int hashCode() { String join = StringUtils.join(new Object[] { ip, port, user, password }, "\r\n"); return join.hashCode(); }
From source file:com.stratio.explorer.cassandra.dto.TableDTO.java
/** * Transform Table toDTO table visualize. * @param table Table//from w w w .j a v a2s . c o m * @return String with table visualize. */ public String toDTO(Table table) { String message = typeDTO + StringUtils.join(table.header(), StringConstants.TABULATOR) + System.getProperty("line.separator") + new RowsDTO().toDTO(table.rows()); return message; }
From source file:com.github.stagirs.common.document.Tag.java
@Override public String toString() { return StringUtils.join(words, " ") + ": " + semantic; }
From source file:com.alibaba.otter.shared.common.utils.JavaSourceCompilerTest.java
@Test public void testSimple() { String javasource = null;/*from w w w.ja v a 2s .co m*/ try { List<String> lines = IOUtils .readLines(Thread.currentThread().getContextClassLoader().getResourceAsStream("compiler.txt")); javasource = StringUtils.join(lines, "\n"); } catch (IOException e1) { e1.printStackTrace(); } JdkCompiler compiler = new JdkCompiler(); Class<?> clazz = compiler.compile(javasource); System.out.println(clazz.getName()); }
From source file:com.linkedin.pinot.tools.Quickstart.java
public static String prettyprintResponse(JSONObject response) throws JSONException { final String TAB = "\t\t"; final String NEW_LINE = "\n"; StringBuilder bld = new StringBuilder(); if (response.has("selectionResults") && response.getJSONObject("selectionResults") != null) { JSONArray columns = response.getJSONObject("selectionResults").getJSONArray("columns"); String[] columnsArr = new String[columns.length()]; for (int i = 0; i < columns.length(); i++) { columnsArr[i] = columns.getString(i); }/*from www . ja v a 2 s . com*/ bld.append(StringUtils.join(columnsArr, TAB) + NEW_LINE); JSONArray rows = response.getJSONObject("selectionResults").getJSONArray("results"); for (int i = 0; i < rows.length(); i++) { JSONArray a = rows.getJSONArray(i); String[] rowsA = new String[a.length()]; for (int j = 0; j < a.length(); j++) { rowsA[j] = a.getString(j); } bld.append(StringUtils.join(rowsA, TAB) + NEW_LINE); } return bld.toString(); } else if (response.has("aggregationResults") && response.getJSONArray("aggregationResults").length() > 0 && !response.getJSONArray("aggregationResults").getJSONObject(0).has("groupByResult")) { JSONArray aggs = response.getJSONArray("aggregationResults"); for (int i = 0; i < aggs.length(); i++) { bld.append(aggs.getJSONObject(i).getString("function") + TAB); } bld.append(NEW_LINE); for (int i = 0; i < aggs.length(); i++) { bld.append(aggs.getJSONObject(i).getString("value") + TAB); } return bld.toString(); } else { JSONObject groupByResult = response.getJSONArray("aggregationResults").getJSONObject(0); bld.append(groupByResult.getString("function") + TAB); JSONArray rowCols = groupByResult.getJSONArray("groupByColumns"); String[] rowColsArr = new String[rowCols.length()]; for (int i = 0; i < rowCols.length(); i++) { rowColsArr[i] = rowCols.getString(i); } bld.append(StringUtils.join(rowColsArr, TAB) + NEW_LINE); JSONArray groupByResults = groupByResult.getJSONArray("groupByResult"); for (int i = 0; i < groupByResults.length(); i++) { JSONObject entry = groupByResults.getJSONObject(i); bld.append(entry.getString("value") + TAB); JSONArray colVals = entry.getJSONArray("group"); String[] colValsArr = new String[colVals.length()]; for (int j = 0; j < colVals.length(); j++) { colValsArr[j] = colVals.getString(j); } bld.append(StringUtils.join(colValsArr, TAB) + NEW_LINE); } return bld.toString(); } }