Example usage for org.apache.commons.lang StringUtils join

List of usage examples for org.apache.commons.lang StringUtils join

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils join.

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

Joins the elements of the provided Collection into a single String containing the provided elements.

Usage

From source file:com.nigelsmall.load2neo.AbstractRelationship.java

public String toString() {
    ArrayList<String> parts = new ArrayList<>();
    parts.add("(");
    parts.add(this.startNode.getName());
    parts.add(")-[:");
    parts.add(this.type);
    if (this.properties != null) {
        if (parts.size() > 0) {
            parts.add(" ");
        }/*from  ww w .ja va  2  s.c o  m*/
        try {
            parts.add(mapper.writeValueAsString(this.properties));
        } catch (IOException e) {
            //
        }
    }
    parts.add("]->(");
    parts.add(this.endNode.getName());
    parts.add(")");
    return StringUtils.join(parts, "");
}

From source file:com.dilipkumarg.qb.core.JoinClauseBuilder.java

@Override
public SqlQuery build() {
    List<Object> args = Lists.newArrayList();
    List<String> queries = Lists.newArrayList();

    for (JoinCondition condition : joinConditions) {
        SqlQuery joinQuery = condition.buildJoin();
        args.addAll(Arrays.asList(joinQuery.getArgs()));
        queries.add(joinQuery.getQuery());
    }/*from ww w .  j  ava 2  s.  c om*/

    return new SqlQuery(StringUtils.join(queries, " "), args);
}

From source file:com.alibaba.otter.shared.common.utils.cmd.Exec.java

public static Result execute(String[] cmds, String outputLog, byte[] input, File workingDir) throws Exception {
    // ??commandcommand?????
    Process process = Runtime.getRuntime().exec(cmds, null, workingDir);
    return execute(process, StringUtils.join(cmds, " "), outputLog, input, workingDir);
}

From source file:edu.cwru.jpdg.Dotty.java

/**
 * Compiles the graph to dotty./*from w  w  w.  j  a v a2 s  .c  o  m*/
 */
public static String dotty(String graph) {

    byte[] bytes = graph.getBytes();

    try {
        ProcessBuilder pb = new ProcessBuilder("dotty");
        pb.redirectError(ProcessBuilder.Redirect.INHERIT);
        Process p = pb.start();
        OutputStream stdin = p.getOutputStream();
        stdin.write(bytes);
        stdin.close();

        String line;
        BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
        List<String> stdout_lines = new ArrayList<String>();
        line = stdout.readLine();
        while (line != null) {
            stdout_lines.add(line);
            line = stdout.readLine();
        }
        if (p.waitFor() != 0) {
            throw new RuntimeException("javac failed");
        }

        return StringUtils.join(stdout_lines, "\n");
    } catch (InterruptedException e) {
        throw new RuntimeException(e.getMessage());
    } catch (IOException e) {
        throw new RuntimeException(e.getMessage());
    }
}

From source file:com.eviware.soapui.impl.wsdl.monitor.ContentTypes.java

@Override
public String toString() {
    return StringUtils.join(contentTypes, ", ");
}

From source file:de.tudarmstadt.ukp.dkpro.argumentation.sequence.report.ConfusionMatrixTools.java

public static String prettyPrintConfusionMatrixResults(ConfusionMatrix cm) {

    cm.printNiceResults();/* ww w  .j a v  a  2  s .  c  o m*/

    String f = "%.3f";

    List<String> header = new ArrayList<>();
    List<String> row = new ArrayList<>();

    header.add("Macro F1");
    header.add("Accuracy");
    header.add("Acc CI@95");

    row.add(String.format(Locale.ENGLISH, f, cm.getMacroFMeasure()));
    row.add(String.format(Locale.ENGLISH, f, cm.getAccuracy()));
    row.add(String.format(Locale.ENGLISH, f, cm.getConfidence95Accuracy()));

    Map<String, Double> precisionForLabels = cm.getPrecisionForLabels();
    Map<String, Double> recallForLabels = cm.getRecallForLabels();
    Map<String, Double> fMForLabels = cm.getFMeasureForLabels();

    SortedSet<String> labels = new TreeSet<>(precisionForLabels.keySet());

    for (String label : labels) {
        header.add(label + " P");
        row.add(String.format(Locale.ENGLISH, f, precisionForLabels.get(label)));

        header.add(label + " R");
        row.add(String.format(Locale.ENGLISH, f, recallForLabels.get(label)));

        header.add(label + " F1");
        row.add(String.format(Locale.ENGLISH, f, fMForLabels.get(label)));
    }

    return StringUtils.join(header, GLUE) + "\n" + StringUtils.join(row, GLUE);
}

From source file:com.netflix.priam.resources.CassandraConfigResource.java

@GET
@Path("/get_seeds")
public Response getSeeds() {
    try {// w  ww . ja  v  a 2  s  . co m
        final List<String> seeds = priamServer.getInstanceIdentity().getSeeds();
        if (CollectionUtils.isNotEmpty(seeds)) {
            return Response.ok(StringUtils.join(seeds, ',')).build();
        }
        logger.error("Cannot find the Seeds {}", seeds);
    } catch (Exception e) {
        logger.error("Error while executing get_seeds", e);
        return Response.serverError().build();
    }
    return Response.status(500).build();
}

From source file:de.tudarmstadt.ukp.csniper.webapp.search.cqp.CqpMacro.java

@Override
public String toString() {
    return "Macro[" + name + ", " + comment + ", " + paramCount + "]\n" + "{{\n" + StringUtils.join(body, "\n")
            + "\n}}\n";
}

From source file:de.sjka.jenkins.view.branches.BranchBadgeAction.java

public String getBranch() {
    List<String> branches = new LinkedList<String>();
    if (BranchOverviewActionFactory.isApplicable(build)) {
        for (String thatBranch : ((Actionable) build).getAction(GitTagAction.class).getTags().keySet()) {
            // skip "*/HEAD" since it's not a branch in our sense
            if (thatBranch.endsWith("/HEAD")) {
                continue;
            }/*from   w ww. j av  a  2s . c  o  m*/

            // cut off "origin/" since that's the default most of the time
            if (thatBranch.startsWith("origin/")) {
                thatBranch = thatBranch.replace("origin/", "");
            }

            branches.add(thatBranch);
        }
    }
    return "(" + StringUtils.join(branches, ", ") + ")";
}

From source file:eu.annocultor.data.destinations.RdfGraph.java

@Override
public void startRdf() throws Exception {
    super.startRdf();

    persistenceWriter = SesameWriter.createRDFXMLWriter(getFinalFile(getVolume()),
            getEnvironment().getNamespaces(), getId(), StringUtils.join(getComments(), "\n"), 1024, 100 * 1024);
    persistenceWriter.startRDF();/*  w  w w.ja v  a  2 s  .  co m*/
}